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-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!

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