11-14-2016 12:53 AM
I have DB table and want to use in SAS server. I need sorted data then I can use by statement in data step to skip sorting.
by Id ;
For more detail, You can refer to this post
With reference to this post
My requirement is to sort on SAS server and I do not want DB server to sort the data. Reason is DB server and SAS server are sorting based on different language. What option should I provide so that sorting in DB can be stopped.
11-14-2016 02:48 AM
proc sort data=db.sample out=sample ; by id; run;
If that does not prevent the wrong sort (as SAS might pass off some of the work to the DB), do
data sample; set db.sample; run; proc sort data=sample; by id; run;
11-14-2016 04:18 AM
Yes I can do that. But I have many such data step so I would end up writing too many code.
I will go by this solution, if there are none.
11-14-2016 05:06 AM
If you want that the work will be done in the SAS server, then you need bring your data to it.
As you need many DB tables, in order to downsize the SAS code, use a macro to do the work
and supply it an argumnt of table names.
I shall use first code presented by @KurtBremser, but you can change the inner code to any desired one.
%let no_of_tables = %sysfunc(countw(&tables));
%do i=1 %to &no_of_tables;
%let tb_name = %scan(&tables, &i);
proc sort data=db.&tb_name out=&tb_name ; by id; run;
%get_db(sample1 sample2 sample3 ... ); /* enter DB tables you need */
Need further help from the community? Please ask a new question.