I maintain a dataset named as "XYZ" . eg. XYZ contains only one column as show name A, B, C, X, Y, Z....
Dataset XYZ:
Show_name |
A |
B |
C |
X |
Y |
Z |
Every week I update the dataset XYZ and sort them to get dataset ABC with the below code.
/*Sort all show name in ascending order*/
Proc Sort Data=XYZ;
By Show_Name;
Run;
/*Create Serial number and Date stamp*/
Data ABC;
Set XYZ;Format Date mmddyy.;
Serial_no=_n_;
Date=today();
Run;
Dataset ABC:
Serial No | Date | Show_Name |
1 | 3/23/2016 | A |
2 | 3/23/2016 | B |
3 | 3/23/2016 | C |
4 | 3/23/2016 | X |
5 | 3/23/2016 | Y |
6 | 3/23/2016 | Z |
Now, in future when I refresh XYZ and see a new show in the list (eg. P and Q).so instead of sorting and giving serial number. I just want to sort new show_name and give serial number to P and Q. only.
Desired Output:
Serial No | Date | Show_name |
1 | 3/23/2016 | A |
2 | 3/23/2016 | B |
3 | 3/23/2016 | C |
4 | 3/23/2016 | X |
5 | 3/23/2016 | Y |
6 | 3/23/2016 | Z |
7 | 3/24/2016 | P |
8 | 3/24/2016 | Q |
Please describe how you would add the values of P and Q on the later date.
Different approaches would be open depending on your method.
I maintain a dataset named XYZ, which I refresh on monthly basis.
Varaible?
Data ABC;
Set XYZ end=done;
output;
if done then do;
date = today();
serial_no = serial_no + 1;
varaible = "P";
output;
serial_no = serial_no + 1;
varaible = "Q";
output;
end;
Run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.
Find more tutorials on the SAS Users YouTube channel.