SAS 问题,多谢。

S
Sionseventh
楼主 (未名空间)

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';
b
baggio0218

唉 sas感觉都快死了
很多都是r或者python

S
Sionseventh


【 在 baggio0218 (Good  Luck!) 的大作中提到: 】
: 唉 sas感觉都快死了
: 很多都是r或者python

只是学来玩玩
a
ashcroft

它不需要知道啊 你只是创建了一个格式,还没使用。如果使用的时候性别不是1/2会报错的
S
Sionseventh

谢谢,祝好。
【 在 ashcroft (meiyou) 的大作中提到: 】
: 它不需要知道啊 你只是创建了一个格式,还没使用。如果使用的时候性别不是1/2会报
: 错的

b
bluesky321

sas的所谓格式,是个很好的发明,功能很强大。别的语言好像没有。
S
Sionseventh


d
dido2009

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的所谓格式,是个很好的发明,功能很强大。别的语言好像没有。

S
StatsGuy

现在还在用SAS的 公司还多吗? 好像在Indeed上搜SAS工作机会,好多都是migration away from SAS。。。