LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (December 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 18 Dec 2008 11:05:30 -0600
Reply-To:     Mary <mlhoward@avalon.net>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mary <mlhoward@AVALON.NET>
Subject:      Re: Compare and read values into master data table
Comments: To: sasbeginner <pattukuttani@GMAIL.COM>
Content-Type: text/plain; charset="iso-8859-1"

OK, here is a revised version of the code that I did with Howard's ideas incorporated into it. Good luck; let us know if we can help more.

-Mary

%let start_month=feb09;

data master; infile cards missover; input Userid trans_id sales_code dec2008_sales nov2008_sales sept2008_sales dec2008_returns nov2008_returns sept2008_returns; cards; 1 100 10 5 4 5 0 2 1 2 101 10 1 1 1 0 0 0 3 102 11 9 9 9 8 5 3 1 100 11 12 10 19 0 0 7 run;

data monthly; infile cards missover; input Userid trans_id sales_code jan2009_sales jan2009_returns; cards; 1 100 10 50 10 2 101 10 10 5 4 105 12 5 2 ; run;

data months; start_month = input("&start_month",monyy7.); informat month $7.; do monthindex = 1 to 24; month = put( intnx( 'mon', start_month,-(monthindex) ), monyy7. ); output; end; run;

proc sql noprint; select trim(month) || '_sales' into :salesmonths separated by ' ' from months; select trim(month) || '_returns' into :returnmonths separated by ' ' from months; quit; %put sales months=&salesmonths; %put return months=&returnmonths;

proc sort data=master; by userid trans_id sales_code; run;

proc sort data=monthly; by userid trans_id sales_code; run;

data newmaster; retain userid trans_id sales_code &salesmonths &returnmonths; merge master monthly; by userid trans_id sales_code; keep userid trans_id sales_code &salesmonths &returnmonths; run;

----- Original Message -----

Dear Mary,

Thanks a lot for the code. Yes the data set is going to be used for statistical analysis and the end users wants it to see only in horizontal way. I appreciate your time and effort for the code and I believe it would take some time for me to understand and them play around for my data set.

I thank each one of you for having a look at my post. I sincerely appreciate their time and help each of you extended.

Regards, SAS Beggy


Back to: Top of message | Previous page | Main SAS-L page