编程技术、软件应用与系统模拟

(Programming, Applicaiton and Simulation)



本站目录

 

首页
ASP/Access/IIS
DELPHI/PASCAL
PASCAL高级编程
C语言编程实例
WORD
Excel
MATLAB
MINITAB讲座
Windows
DOS
SAS
生物系统模拟
土壤水分剖析器
其他



镜像站点

 

主站
北美镜象站
欧洲镜象站(1)
欧洲镜象站(2)

本站 Google

[搜索]  [站内导航]
座右铭:
只做有益人类的事
不做有害人类的事


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

© 1998-, 董占山, 版权所有。
转载文章请注明出处(www.sunfinedata.com/articles)。