Desktop productivity for business analysts and programmers

Proc Expand

Accepted Solution Solved
Reply
Contributor
Posts: 30
Accepted Solution

Proc Expand

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=MPS_score1 out=MPS_score from=qtr to=month;
convert MDHCP;
by RESCID FullName;
id new_date;
run;

 

how to get the other two months 


Accepted Solutions
Solution
‎03-15-2018 12:04 PM
Trusted Advisor
Posts: 1,284

Re: Proc Expand

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.

View solution in original post


All Replies
Super User
Posts: 22,844

Re: Proc Expand

For a problem like this we also need sample data to replicate your issue.
Contributor
Posts: 30

Re: Proc Expand

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

 

Solution
‎03-15-2018 12:04 PM
Trusted Advisor
Posts: 1,284

Re: Proc Expand

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.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 189 views
  • 0 likes
  • 3 in conversation