|
|
Teaching Materials
Macro-Code
Example Program |
Statement: %VLIST (datain=d1b,htmlout=htmla);
|
| Description: Generate List
of Variables. Input data set is "d1b". HTML output
is writen to the file referenced by "htmla". |
| NAME |
TYPE |
LABEL |
| gender |
Numeric |
Gender:/GENDER |
| age |
Numeric |
Age
in Years:/AGE |
| politic |
Numeric |
Political/Party:/POLITIC |
|
|
Macro-Code
Example Program |
Statement:
%FREQT (datain=d2,htmlout=&htmlb,tablen=1.,var=gender,descrip=gender
of respondent);
%FREQT (datain=d2,htmlout=&htmlb,tablen=2.,var=age,descrip=age
(yrs) of respondent);
|
| Description: Generate Frequency
of Variables |
| Table
1. Frequency distribution for gender of respondent |
| gender |
COUNT |
PERCENT |
| 0 |
6 |
54.5 |
| 1 |
5 |
45.5 |
| Table
2. Frequency distribution for age (yrs) of respondent |
| age |
COUNT |
PERCENT |
| 16 |
3 |
27.3 |
| 17 |
4 |
36.4 |
| 18 |
4 |
36.4 |
|
|
|
Macro-Code
Example Program |
Statement:
%MPCT (datain=d1,htmlout=&htmlc,tablen=3.,var=gender politic,descrip=Percent
of Respondents that are ...);
|
| Description: Generate Percent
for Variable or List |
| Table
3. Percent of Respondents that are ... |
| Variable
Name |
Description |
Percent |
| gender |
Gender(Female):/GENDER |
45% |
| politic |
Political/Party(Republican):/POLITIC |
45% |
|
|
Macro-Code
Example Program |
Statement:
%npct(datain=sample,tablen=1. ,htmlout=&htmlc, var=var1
var2 ,descrip=testing macro);
|
| Description: Generate Number
and Percent for Variable or List |
Variable
Name |
Description |
Number |
Percent |
| var1 |
ever
use in last 30 days |
6 |
67% |
| var2 |
ever
use in last 48 hours |
7 |
86% |
| SOURCE:pthan01p09.sas
on 01NOV01 |
|
Macro-Code
Example Program |
Statement:
%summary (datain=d1,htmlout=&htmlb,tablen=1.,var1=age,descrip=Age(yrs)
of respondent:age);
run;
|
| Description: Generate Statistics
for Continuous Variables |
| Table
1. Age(yrs) of respondent:age |
| N |
Mean |
Std |
Min |
Max |
| 11 |
17.1 |
0.8 |
16.0 |
18.0 |
| SOURCE:
ptyp01p25.sas on 10/10/01 |
| Table
2. Height(cm) of respondent:ht |
| N |
Mean |
Std |
Min |
Max |
| 11 |
163.6 |
9.0 |
150.0 |
180.0 |
| SOURCE:
ptyp01p25.sas on 10/10/01 |
|
Macro-Code
Example Program |
Statement:
%MEANS(datain=sample2,tablen=1. ,htmlout=&htmlc, var=var1
var2 ,descrip=testing macro);
|
| Description: Generate Mean,
Std Dev., Min and Max for a set of continuous variables |
Variable
Name |
Description |
Number |
Mean |
Std
Dev. |
Min |
Max |
| var1 |
AGE |
6 |
41.7 |
23.9 |
13 |
77 |
| var2 |
WEIGHT |
6 |
134.5 |
48.2 |
80 |
190 |
| SOURCE:pthan01p10.sas
on 02NOV01 |
|
|
| |
|