SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

I need help on this

Reply
Contributor
Posts: 22

I need help on this

data have;

infile datalines;

input id_acc  acc_no  status_code $5. info_date;

format info_date date9.;

datalines;

1111  999585548  AAA 30Jun2007

1111  999585548  AAA 31Jul2007

1111  999585544  D1A 31Aug2007

1111  999585547  D2A 30Sep2007

1111  999585540  D1D 31Oct2007

1111  999585544  AAA 30Nov2007

1111  999585547  AAA 31Dec2007

1111  999585540  D1D 31Jan2008

1111  999585544  D2D 28Feb2008

1111  999585547  D3D 31Mar2008

1111  999585540  D4D 30Apr2008

1111  999585540  D5D 31May2008

1111  999585540  AAA 30Jun2008

1111  999585540  AAA 31Jul2008

1111  999595540  D1D 31Aug2008

1111  999587540  LEP 30Sep2008

1111  999587540  LEP 31Oct2008

1111  999585540  LEP 30Nov2008

1112  999505548  AAA 30Jun2007

1112  999505548  AAA 31Jul2007

1112  999505544  D1A 31Aug2007

1112  999505547  D2A 30Sep2007

1112  999505540  D1D 31Oct2007

1112  999505544  D2D 30Nov2007

1112  999505547  D3D 31Dec2007

1112  999505540  D4D 31Jan2008

1112  999505544  D5D 28Feb2008

1112  999505547  D6D 31Mar2008

1112  999505540  LEP 30Apr2008

1112  999505540  LEP 31May2008

1112  999505540  LEP 30Jun2008

1112  999505540  LEP 31Jul2008

1112  999505540  LEP 31Aug2008

1112  999505540  LEP 31Oct2008

1112  999505540  LEP 30Nov2008

1113  990005548  D1D 30Jun2007

1113  995005548  D2D 31Jul2007

1113  995050544  D3D 31Aug2007

1113  999500547  D4D 30Sep2007

1113  999500540  AAA 31Oct2007

1113  999500544  D1A 30Nov2007

1113  999580547  D2A 31Dec2007

1113  999580540  AAA 31Jan2008

1113  999580544  D1A 28Feb2008

1113  999580547  D2A 31Mar2008

1113  999580540  AAA 30Apr2008

1113  999580540  D1D 31May2008

1113  999585540  D2D 30Jun2008

1113  999585540  D3D 31Jul2008

1113  999585540  LEP 31Aug2008

1113  999585540  LEP 30Sep2008

1113  999585540  LEP 31Oct2008

1113  999585540  LEP 30Nov2008

;

run;

proc print;

run;

/*I have transosed this data set in the following format:*/

id_acc  30Jun2007 ---  30Nov2008

1111    AAA--------------LEP

2222    AAA--------------LEP

3333    D1D--------------LEP

NOW WHAT I WANT THE OUTPUT IN THE FOLLOWING FORMAT:

how many instances the one id_acc remains in  D1A to D1D,D2D TO D5D,D1D TO D1D (and so on) AND FINAL in LEP.

OUTPUT BELOW:

id_acc  30Jun2007 ---  30Nov2008  D1_START  D1_END    D2_START  D2_END    D3_START    D3_END ......dnstart ...dnend        lEP_START_END

1111    AAA--------------LEP      31Aug2007 31Oct2007  31jan2008  31may2008  31Aug2008  31Aug2008                            30Sep2008

2222    AAA--------------LEP      31Aug2007 31Mar2008                                                                        30Apr2008

3333    D1D--------------LEP      30Jun2007 30Sep2007  30Nov2007  31Dec2007  28Feb2008  31Mar2008    31May2008  31Jul2008    31Aug2008

Super User
Posts: 5,441

Re: I need help on this

Don't understand what you try to achieve, try to give a clearer example were you don't focus on output design.

Not knowing the underlying requirement, transposing data the way you describe is seldom a road to success for calculating or reporting.

Data never sleeps
Ask a Question
Discussion stats
  • 1 reply
  • 236 views
  • 0 likes
  • 2 in conversation