Skip to content

Instantly share code, notes, and snippets.

@statgeek
Last active December 17, 2018 18:19
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 statgeek/0cae5568752959b035516d6ac07a20fb to your computer and use it in GitHub Desktop.
Save statgeek/0cae5568752959b035516d6ac07a20fb to your computer and use it in GitHub Desktop.
SAS - using a formatted (date) variable to aggregate data
/*Note that if you apply formats to your date they get grouped according to the format, so having a SAS date is advantageous.
Here's a quick example that shows the calculating of yearly statistics from a data set.*/
proc means data=sashelp.stocks N NMISS min max mean median STACKODS;
class date;
format date year4.;
var open high low;
output out=want n= mean= sum= median= mean= / autoname autolabel;
ods output summary = want2;
run;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment