Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expand Data Set 1

Status
Not open for further replies.

smalek

Programmer
Jan 15, 2009
28
CA
Hi again
I am back requesting help on data set expansion issue. Here is the current layout of the data:

Code Value
001 15
005 25
225 10

Required output:
Code Value CC
001 15 VC
001 15 VDL
001 15 FC
005 25 VC
005 25 VDL
005 25 FC
225 10 VC
225 10 VDL
225 10 FC

Any suggestions much appreciated.
Thanks

 
Code:
data dset2;
  set dset1;

  length CC $3;
  CC = 'VC';
  output;

  CC = 'VDL';
  output;

  CC = 'FC';
  output;
run;

Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
worked like a charm! Thanks ChrisW75
 
No worries.
You can also get smart and use a "DO FOR" loop to do it as well and reduce the manual coding. For the above example it's not an issue, but if you needed to output say 50 copies of each record, it would save alot of coding.

Chris
Business Analyst, Code Monkey, Data Wrangler.
SAS Guru.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top