I have a source table/dataset and I want two separate target tables/datasets Target Table 1, Target Table 2 as below . Please advice.
|
Source table |
Target Table 1 |
Target Table 2 |
||||||||||||||||||||||||||||||||||||||||||
|
|
|
ID is the key column; Name and Phone No are non-key columns
I have tried below code and it worked too.
data source;
input id name $ ph $;
datalines;
10 AAA 123
20 BBB 234
30 CCC 434
40 DDD 343
50 EEE 442
;
run;
data Target1 ;
set one(drop = ph);
run;
data Target2;
set one(drop = name);
run;
Please suggest any other approach and also can we do it in single data step?
All suggestions are welcome.
Thank you.
Try
data table1(keep= id name) table2(keep= id ph);
set source;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.