I have data with all 4 quarter data however when i do Proc Expand and convert from Qtr to Month its only giving up to October data .
New_date is formated as YYq.
proc expand data=MS_score1 out=MS_score from=qtr to=month;
convert MDHCP;
by RID FullName;
id new_date;
run;
how to get the other two months
The problem is in the CONVERT statement, namely the "/observed=..." parameter. When absent, this parameter defaults to "beginning", as in
convert mdhcp /observed=(beginning,beginning);
which tells expand that both the incoming data and the outgoing data represent the "beginning" of the interval. So for from=qtr to=month it means that the last outgoing item is for the beginning of the interval, namely october for quarter 4.
try something like
convert mdhcp/observed=(total,total);
which should divide up each MDHCP into 3 almost-equal amounts. I say "almost equal" because the number of days in various months are "almost equal".
Another option
convert mdhcp/observed=(average,average);
which would work if mchcp is a daily rate, recorded over a month, and you want daily rates for months.
here is a example of the data
name qtr score
JUNG 2017Q1 38
JUNG 2017Q2 19
JUNG 2017Q3 27
JUNG 2017Q4 33
PHAM 2017Q1 17
PHAM 2017Q2 17
PHAM 2017Q3 15
PHAM 2017Q4 16
and the out comes out to be and its missing NOv and dec
JUNGJAN2017
JUNG FEB2017
JUNG MAR2017
JUNG APR2017
JUNG MAY2017
JUNG JUN2017
JUNGJUL2017
JUNGAUG2017
JUNG SEP2017
JUNG OCT2017
PHAMJAN2017
PHAMFEB2017
PHAMMAR2017
PHAM APR2017
PHAMMAY2017
PHAMJUN2017
PHAMJUL2017
PHAM AUG2017
PHAM SEP2017
PHAM OCT2017
The problem is in the CONVERT statement, namely the "/observed=..." parameter. When absent, this parameter defaults to "beginning", as in
convert mdhcp /observed=(beginning,beginning);
which tells expand that both the incoming data and the outgoing data represent the "beginning" of the interval. So for from=qtr to=month it means that the last outgoing item is for the beginning of the interval, namely october for quarter 4.
try something like
convert mdhcp/observed=(total,total);
which should divide up each MDHCP into 3 almost-equal amounts. I say "almost equal" because the number of days in various months are "almost equal".
Another option
convert mdhcp/observed=(average,average);
which would work if mchcp is a daily rate, recorded over a month, and you want daily rates for months.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.