sas - Report using data _Null_ -
i'm looking report using sas data step :
i have data set:
name company date x 199802 x 199705 x d 199901 y b 200405 y f 200309 z c 200503 z c 200408 z c 200404 z c 200309 z c 200210 z m 200109 w g 200010
report i'm looking for:
name company x 1997/05 1998/02 d 1998/02 1999/01 y b 2003/09 2004/05 f 2003/09 2003/09 z c 2002/10 2005/03 m 2001/09 2001/09 w g 2000/10 2000/10
thank you,
tried using proc print not accurate. looking data null solution.
data _null_; set salesdata; name company date; array x(*) from; from=lag(date); if first.name count=1; i=count dim(x); x(i)=.; end; count+1; if first.company do; from_date1=date; end; if last.company to_date=date; if from_date1 ="" , to_date="" delete; run;
data _null_; set yourevents; name company notsorted; file print; if _n_ eq 1 put @01 'name' @06 'company' @14 'from' @22 'to' ; if first.name put @01 name @; ** instructs sas not start new line next put instruction **; retain to; if first.company do; = 1e9; = 0; end; if date lt = date; if date gt = date; if last.company put @06 company @14 yymm7. @22 yymm7. ; run;
Comments
Post a Comment