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

I'm not sure if there is a way of specifying linguistic as the sort order for proc sql but, given what you want, couldn't you just change the sql order statement to: order by upcase(name)

art297
Opal | Level 21

The OP informed me, offline, that the statement didn't work on his/her system.  As such, I suggested another statement that didn't use dictionary.tables.  I still don't know if that worked for the OP, but thought I'd post it here in case anyone else was trying out the method.

I should admit, up front, that any SAS instructors I've ever had would cringe at my code.  Since one can only include 255 characters in an abbreviation, I had to remove as many characters as possible that would still allow the code to run as designed.  In short, please, PLEASE, DON'T start writing your own code as shown below.  The following is one long continuous line:

gsubmit "dat x;d='%8b'||'.'||'%32b';leng n$32;do s=open(d,'I')whil(s!0);do i=1to attrn(s,'NVARS');n=upcase(varname(s,i));outp;en;s=close(s);en;pro sql nopri;sele n into:n separa by' 'fro x order n;qui;pro delete dat=x;ru;pro fsvie dat=%8b.%32b;va &n;ru;";

Of course, setting the above code as an action command will produce a number of warnings in the log but, as it was only intended to bring up fsview, I thought that might still be acceptable.

OS2Rules
Obsidian | Level 7

Art:

I don't know why you are so worried - I writ my code like tht all the tim. 

I've been in this business about 30 years, man and boy, and I have yet to meet anyone who can touch-type!

I sent you a private reply with the results of the code you provided (for the record - it didn't work quite as expected).

Thanks again for all the help - above and beyond.

art297
Opal | Level 21

With a LOT of help from Randy Herbison (I cross posted the question on SAS-L), a solution was found that solved the original problem.  It used the same method as the one described in the original reference I posted (i.e., http://support.sas.com/resources/papers/proceedings10/046-2010.pdf ), but gets around the 255 character limitation by gsubmit-ing the code with a %include statement.

Thus, the main code was saved to a text file with a .SAS extension.  I called mine c:\viewfs.sas :

*** c:\viewfs.sas ***;

data _forview;

length name $32;

do dsid=open("&dsn",'I') while(dsid ne 0);

   do i=1 to attrn(dsid,'NVARS');

     name=upcase(varname(dsid,i));

     output;

   end;

   dsid=close(dsid);

end;

run;

proc sql noprint;

select name into :names

   separated by ' '

     from _forview

       order by name

;

quit;

proc delete data=_forview;

run;

proc fsview data=&dsn;

var &names.;

run;

That code, in turn, was %include-ed via the following gsubmit as the action command:

gsubmit "%%let dsn=%8b.%32b; %%include 'c:\viewfs.sas';"

FYI, the %%let dsn=%8b.%32b; at the beginning of that command is simply creating a macro variable called dsn which will contain the libname and memname of the SAS datafile that one right clicks on from the SAS Explorer window.

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
  • 18 replies
  • 3418 views
  • 1 like
  • 5 in conversation