Skip to content

Instantly share code, notes, and snippets.

@marks
Last active October 18, 2016 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marks/b22b1c44e9ccaa1cc16ff80996a38b97 to your computer and use it in GitHub Desktop.
Save marks/b22b1c44e9ccaa1cc16ff80996a38b97 to your computer and use it in GitHub Desktop.
/*
This SAS code file should output three files:
- sas_output.html (pretty HTML output)
- sas_output.lst (plain text ASCII output)
- sas.log (logs, not results)
*/
ods html file='/mnt/sas_output.html';
PROC PRINTTO LOG='/mnt/sas.log' PRINT='/mnt/sas_output.lst';
RUN;
data dsn;
input patid implants;
datalines;
1 3
1 1
1 2
1 1
2 1
2 2
3 1
4 2
3 1
4 5
2 3
1 6
;run;
*Select only male students and age less than 16;
proc sql;
create table males as
select age, height, weight
from sashelp.class
where sex='M' and age lt 16
order by age;
quit;
*Get the descriptive statistics for height variable by age;
proc means data=males ;
by age;
var height;
output out=htstats mean=mean n=n std=sd median=med min=min max=max;
run;
ods html close;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment