05-22-2018 11:21 AM
Is there an easy way to convert a combined year and month value to a SAS DATE?
I have the following data, and wanted to use some of the SAS Time Series methods
There is a number for year, but it also has a two digit number for month combined. The data are in an Excel format.
Here is asample of the data:
The first variable is January in the year 1895. PCP is the total precipitation for that month.
The data go up to December 2017.
I would like to be able to total up all the PCP for a year, plot it -- then plot the next year’s total PCP, etc all the way up to 2017.
05-22-2018 11:29 AM - edited 05-22-2018 11:32 AM
may this demo help? Mind you! ---The sasdate value will revert to first of the month though
data have; input YearMonth PCP; cards; 189501 6.89 189502 2.94 189503 5.66 ; data want; set have; k=put(YearMonth,8. -l); sasdate=input(k,yymmn6.); format sasdate date9.; run;
05-22-2018 11:30 AM
data have; input YearMonth PCP; cards; 189501 6.89 189502 2.94 189503 5.66 ; data want; set have; sasdate=input(put(YearMonth,8. -l),yymmn6.); format sasdate date9.; run;