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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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
  • 1793 views
  • 0 likes
  • 3 in conversation