BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am making 0 observation datasets from dataset specs in order to check the metadata for "correctness". (i.e. are CDISC names and labels used)

For completeness, I'd like to include the specified sort order, but have as yet not found a way to make that happen.

Any slick ideas for getting this info into the datasets so it ultimately is available in the dictionary tables?

Thanks for any ideas.
2 REPLIES 2
darrylovia
Quartz | Level 8
Diane,

Do you mean to find out the sort order of an existing table?

To do that go to the SAS dictionary tables (sashelp.vcolumn) and look at the field sortedby for the table that you want.

Do you mean to create a SAS table and then tell it what the sort order should be?

PROC DATASETS among other things lets you change the metadata of a dataset. Specifically for your case, you can tell SAS what the sort order is with out sorting the file.

Danger!!!!!
However, this may be quite dangerous for if you insert records not in the sort order sequence that you specify. Merges and other by group processing will not work. I would just sort the file after I updated it or index it.

But below is the example anyways.


proc sql;
create table One
(ID char(12),
x1 num,
x2 num,
x3 num);
quit;

proc datasets library=work nolist;
modify One (sortedby=x1 x2);
quit;

proc contents data=one;
run;


Good Luck
-Darryl
deleted_user
Not applicable
"Do you mean to create a SAS table and then tell it what the sort order should be?"

This is the one. Worked great. Thanks!!! Since these are strictly for checking the accuracy of specifications, no records should ever be added, but I'll remember the warning just in case.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 686 views
  • 0 likes
  • 2 in conversation