Attached is the file with the data i have and the desired output i am looking for.
Please help!
And what are the rules for creating the LAG_EFF and LAG_TERM variables? I don't actuall see any difference between TERM_DATE and LAG_TERM Shown. And the rules for selecting the values to keep in the output?
And if your "dates" are such then I would suggest dropping the completely useless time portion since ever single value you show is 00:00:00. Easily done with the DATEPART function.
Sorry, for not being clear. The lag_term is same as the term date. I done need it. I just need the below output in SAS. Just put that in excel so that it is clear.
If you have a problem with Excel, you should bring it to a Microsoft-oriented forum.
If you need help with SAS data, you should present it in a usable way, as you were already shown in https://communities.sas.com/t5/SAS-Programming/Need-help-in-converting-this-long-dataset-to-a-wide-o...
proc sort data=MEMBER_ADDRESS;
by SEQ_MEMB_ID ADDRESS_TYPE EFFECTIVE_DATE ADDRESS_LINE_1 ;run;
data MEMBER_ADDRESS1;
set MEMBER_ADDRESS;
by SEQ_MEMB_ID ADDRESS_TYPE EFFECTIVE_DATE ADDRESS_LINE_1;
retain LAG_EFF;
if FIRST.ADDRESS_LINE_1 then do;
LAG_EFF=EFFECTIVE_DATE;
end;
if LAST.ADDRESS_LINE_1 then do;
output;
end;
format LAG_EFF datetime20.;
run;
This is the code, i am using. But i am not getting the desired output (want :Last table) as mentioned in the attached excel. Sorry for not being clear initially
@SDasari2 wrote:
This is the code, i am using. But i am not getting the desired output (want :Last table) as mentioned in the attached excel. Sorry for not being clear initially
You should show the incorrect result your are getting FOR the example data shown only.
One might guess that your sort is grouping more values than you expect.
Attached file has the output i am getting. The last set of values. I dropped the Phone Number and County.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.