little book里的一段,有点儿问题。程序是如何知道在性别栏里找1,2, 在年龄栏里找年龄数字的?
PROC FORMAT; VALUE gender 1 = 'Male' 2 = 'Female'; VALUE agegroup 13 -< 20 = 'Teen' 20 -< 65 = 'Adult' 65 - HIGH = 'Senior';
详细见下面
Example Universe Cars is surveying its customers as to their preferences for car colors. They have information about the customer’s age, sex (coded as 1 for male and 2 for female), annual income, and preferred car color (yellow, gray, blue, or white). Here are the data: 19 1 14000 Y 45 1 65000 G 72 2 35000 B 31 1 44000 Y 58 2 83000 W The following program reads the data; creates formats for age, sex, and car color using the FORMAT procedure; then prints the data using the new formats: DATA carsurvey; INFILE 'c:MyRawDataCars.dat'; INPUT Age Sex Income Color $; PROC FORMAT; VALUE gender 1 = 'Male' 2 = 'Female'; VALUE agegroup 13 -< 20 = 'Teen' 20 -< 65 = 'Adult' 65 - HIGH = 'Senior'; VALUE $col 'W' = 'Moon White' 'B' = 'Sky Blue' 'Y' = 'Sunburst Yellow' 'G' = 'Rain Cloud Gray';
little book里的一段,有点儿问题。程序是如何知道在性别栏里找1,2, 在年龄栏里找年龄数字的?
PROC FORMAT;
VALUE gender 1 = 'Male'
2 = 'Female';
VALUE agegroup 13 -< 20 = 'Teen'
20 -< 65 = 'Adult'
65 - HIGH = 'Senior';
详细见下面
Example Universe Cars is surveying its customers as to their preferences for car colors. They
have information about the customer’s age, sex (coded as 1 for male and 2
for female), annual
income, and preferred car color (yellow, gray, blue, or white). Here are the data:
19 1 14000 Y
45 1 65000 G
72 2 35000 B
31 1 44000 Y
58 2 83000 W
The following program reads the data; creates formats for age, sex, and car color using the
FORMAT procedure; then prints the data using the new formats:
DATA carsurvey;
INFILE 'c:MyRawDataCars.dat';
INPUT Age Sex Income Color $;
PROC FORMAT;
VALUE gender 1 = 'Male'
2 = 'Female';
VALUE agegroup 13 -< 20 = 'Teen'
20 -< 65 = 'Adult'
65 - HIGH = 'Senior';
VALUE $col 'W' = 'Moon White'
'B' = 'Sky Blue'
'Y' = 'Sunburst Yellow'
'G' = 'Rain Cloud Gray';
唉 sas感觉都快死了
很多都是r或者python
【 在 baggio0218 (Good Luck!) 的大作中提到: 】
: 唉 sas感觉都快死了
: 很多都是r或者python
只是学来玩玩
它不需要知道啊 你只是创建了一个格式,还没使用。如果使用的时候性别不是1/2会报错的
谢谢,祝好。
【 在 ashcroft (meiyou) 的大作中提到: 】
: 它不需要知道啊 你只是创建了一个格式,还没使用。如果使用的时候性别不是1/2会报
: 错的
sas的所谓格式,是个很好的发明,功能很强大。别的语言好像没有。
嗯
Yes,Proc Format is one of the beautiful things in SAS, I love it. It is
quite unique, other analytic tools don't have the similar thing.
【 在 bluesky321 (bluesky) 的大作中提到: 】
: sas的所谓格式,是个很好的发明,功能很强大。别的语言好像没有。
现在还在用SAS的 公司还多吗? 好像在Indeed上搜SAS工作机会,好多都是migration away from SAS。。。