BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
BTAinRVA
Quartz | Level 8

Hello All!

 

Am I correct in saying that, with the code below, the dataset check will be sorted and deduped but the dataset kicks will not be sorted or deduped?

 

proc sort data = kicks nodupkey out=check; by edipn; run;

 

 

Thanks,

Brian

1 ACCEPTED SOLUTION

Accepted Solutions
mkeintz
PROC Star

This is an excellent opportunity for experimentation:

 

data class;
  set sashelp.class;
run;

proc sort data = class nodupkey out=class2;
  by age;
run;

Data set class, a clone of sashelp.class is sorted by name.   So the above uses your programming logic.  Compare the CLASS2 data set (proc print data=class2;run;) to data set CLASS.  They are only 19 observations long.  You will have used SAS to answer your SAS question.

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

View solution in original post

3 REPLIES 3
mkeintz
PROC Star

This is an excellent opportunity for experimentation:

 

data class;
  set sashelp.class;
run;

proc sort data = class nodupkey out=class2;
  by age;
run;

Data set class, a clone of sashelp.class is sorted by name.   So the above uses your programming logic.  Compare the CLASS2 data set (proc print data=class2;run;) to data set CLASS.  They are only 19 observations long.  You will have used SAS to answer your SAS question.

 

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
ballardw
Super User

Almost. The code will not change the sort order of the kicks data set. If it were already sorted that order would remain. No records should be removed either.

Reeza
Super User
You can think of this, as a situation, where the input data set is not modified in any manner. Any modifications are on the out data set.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 590 views
  • 4 likes
  • 4 in conversation