Programming and Application(编程与应用)


Content(目录)




Linux


MySQL
Office















 
PCNow 30-Day Free Trial, Remote PC Access
 
Logo_234x60

Examples for manipulating dataset in SAS


Examples for manipulating dataset in SAS

Zhanshan Dong

1) Read data from a file
When using SAS, you will alsways want to read data from a existing data file. This will simplify the copy data around and waste the disk space, share a same set of data with as many as possible SAS scripts. So using data files is convenient and necessary. The following piece of code is to demonstrate how to use infile command in data statement.
data bone;
  infile '../multivar/BONE.DAT';
  input person y1-y4;
  drop person;
run;
2) Generate multiple observations from a record
Multiple observations can be generate from one data records in data file or data block. Sometime it is necessary to do that because different data arrangements. If the raw data is entered and organised in a way and the data analysis should be done in another way, you should turn to this technology. The following piece of code can achieve this goal.
data set1;
  input DONUT FAT1-FAT6;
  FAT=FAT1; REP=1; output;
  FAT=FAT2; REP=2; output;
  FAT=FAT3; REP=3; output;
  FAT=FAT4; REP=4; output;
  FAT=FAT5; REP=5; output;
  FAT=FAT6; REP=6; output;
  drop FAT1-FAT6;
  cards;
1 64 72 68 77 56 95
2 78 91 97 82 85 77
3 75 93 78 71 63 76
4 55 66 49 64 70 68
;
run;
3) Merge multiple datasets into one dataset
When data necessary for an analysis are distributed in several datasets in SAS, you cannot do the corresponding analysis unless you merge the several datasets into one dataset. There are two general classes of data mergement. One is merging
©董占山Zhanshan Dong

Post comments(留言)

Name(名字):

Comment(内容):


由Google提供

SunfineData Products|U's Bargain Network|Contact Me(与我联系)
© 1998-, 董占山, 版权所有, 欢迎转载文章链接。
转载文章和软件请注明出处(http://articles.sunfinedata.com/)。