标签:sel inpu int bsp use 临时 处理 oct class
data sasuser.talent10; set sasuser.talent; month=month(lasthried); where month=10; run; /*sum等算数函数可以直接加不是numeric类型的变量,会建立一个临时变量将char变成num,但是where不行*/ /* Base2=input(testbase,4.)-avgbase; mean(of a1-a5); 一系列变量时*/ data sasuser.talent2; set sasuser.talent; FtHeight=input(height,2.)/12; /*input字符变数字,format用cha本身的!!*/ proc print data=sasuser.talent2; run; /*产生cha变量*/ /* a=sex; sex本身就是cha a=sex||‘/‘||age; concatenate a=sex||‘/‘||put(age,4); */ data sasuser.njtalent; set sasuser.talent; NewPhone=‘(201)‘||put(phone,7.); run; proc print data=sasuser.njtalent; var id phone newphone; run; data sasuser.talent10; set sasuser.talent; month=month(lasthired); run; proc print data=sasuser.talent10; where month=10; run; data sasuser.talent10; set sasuser.talent; if month(lasthired)=10; format lasthired date9.; /*给5位数的date一个12FEB2000这样一个可读的格式*/ run; proc print data=sasuser.talent10; run; data sasuser.taloct99; set sasuser.talent; if year(lasthired)=1999 and month(lasthired)=10; format lasthired date9.; run; proc print data=sasuser.taloct99; run; data sasuser.master; set sasuser.talent( OBS=5); rephired=mdy(month,day,1998); format rephired date9.; AA=DATE(); BB=TODAY(); run; proc print data=sasuser.master ; run; data master; set sasuser.master; qtrselapsed=intck(‘qtr‘,rephired,lasthired); /*计算时差*/ run; proc print data=master; run; /*给二参数,向后加5个月,b表示1号,m=15号,e=30号*/ MonthX=intnx(‘month‘,‘01jan95‘d,5,‘b‘); /*12935 (June 1, 1995)*/ MonthX=intnx(‘month‘,‘01jan95‘d,5,‘m‘); /*12949 (June 15, 1995)*/ MonthX=intnx(‘month‘,‘01jan95‘d,5,‘e‘);/*12964 (June 30, 1995)*/
标签:sel inpu int bsp use 临时 处理 oct class
原文地址:https://www.cnblogs.com/super-yb/p/11830105.html