Beruflich Dokumente
Kultur Dokumente
/* file chap01.sas */
/* Set up Information
*/
john
sally
;
run;
M 16 70 165
F 16 63 120
/* print data */
proc print data=htwt;
run;
* print to Output;
* PROC PLOT;
* plot y against x;
* PROC GPLOT;
* plot y against x;
* open HTWT;
* read HTWT;
* KEEP statement;
* DROP statement;
*
*
*
*
drop x;
proc means data=htwt2 maxdec=3;
run;
* sorted data;
* sorting variable;
* sorting variables;
1 72
2 69
;
proc sort data=test;
by id;
proc print data=test;
run;
data test;
merge test htwt2;
by id;
proc print data=test;
run;
/* Appendix 1B */
options label nodate nonumber linesize=78;
/* Create a new SAS data set */
data htwt;
input name $ sex $ age height weight;
datalines;
alfred M 14 69 112
alice F 13 56 84
barbara F 14 62 102
henry M 15 67 135
john M 16 70 165
sally F 16 63 120
;
run;
/* Read in an external ASCII file brumm.dat */
/* Add labels
*/
data brumm;
infile 'brumm.dat';
input money inflation growth initial poprate inv school;
label money = 'growth rate of money supply'
inflation = 'growth rate of prices'
growth = 'growth rate of output'
initial = 'initial level of GDP per capita'
poprate = 'average population growth rate'
inv = 'average investment share of GDP'
school = 'educational attainment';
run;
proc contents data=brumm position;
run;
/* Save SAS dataset brumm.sas7bdat */
data 'brummdata';
set brumm;
run;
/* Read existing SAS dataset c:\data\poe4sas\cps.sas7bdat */
data cps;
set 'cps';
run;
/*-----------------------------------------------*/
/* Example 4: Import stata data set using wizard */
/* SAS will generate code for future use
*/
/*-----------------------------------------------*/
PROC IMPORT OUT= POE4SAS.SIRMANSDATA
DATAFILE= "C:\data\poe4sas\sirmans.xlsx"
DBMS=EXCEL REPLACE;
RANGE="Data$";
GETNAMES=YES;
MIXED=NO;
SCANTEXT=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;
proc contents data=poe4sas.sirmansdata;
RUN;