BookmarkSubscribeRSS Feed
ameshram28
Calcite | Level 5

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 NoDateShow_Name
13/23/2016 A
23/23/2016B
33/23/2016C
43/23/2016X
53/23/2016Y
63/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 NoDateShow_name
13/23/2016A
23/23/2016B
33/23/2016C
43/23/2016X
53/23/2016Y
63/23/2016Z
73/24/2016P
83/24/2016Q

  

3 REPLIES 3
ballardw
Super User

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.

ameshram28
Calcite | Level 5

I maintain a dataset named XYZ, which I refresh on monthly basis. 

PGStats
Opal | Level 21

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;
PG

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to choose a machine learning algorithm

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.

Discussion stats
  • 3 replies
  • 882 views
  • 0 likes
  • 3 in conversation