As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.


Here are some tips for How to share your SAS knowledge with your professional network.


Tips Talk:Easy Way to Get All Variable Names From a Dataset

From sasCommunity
Jump to: navigation, search

Please include a link to the presentation of the %SYSFUNC approach.--Howles 03:07, 10 September 2009 (UTC)


Link added, changes made to text and formatting. I think this tip is ok now.--Art Carpenter 05:08, 11 September 2009 (UTC)


Promoting to TIP READY after [not] removing the link to a non-existing page:
"User account 'SPM' is not registered. Please check if you want to
create this page. You have followed a link to a page that does not exist yet."
As discussed in Advisory Board weekly phone-meeting, 'anon' is an option. Hence
"Contact me at my Discussion Page." is [not] removed from after "Submitted by SPM."
Charlie Shipp 12:28, 11 September 2009 (UTC)


Actually, I've added a one-line sentence to where the link goes:
"This sasCommunity page can be used for community discussion of SPM tips."
HTH, hope-this-helps, Charlie Shipp 12:28, 11 September 2009 (UTC)

Each page (tip or otherwise) has a Discussion tab. That's where the content (tip or otherwise) ought to be discussed, right?--Howles 18:19, 23 September 2009 (UTC)


Macro needs generalization for two-part names

Seems to me this macro needs a second argument to pass in a LIBREF. It could default to WORK or USER.--Howles 18:21, 23 September 2009 (UTC)


This macro can clobber the already existing global variable. -- chang_y_chung 22:02, 14 January 2011 (UTC)

I would probably recommend using the version on the FullCode tab of the usage note

  instead of upcase("&dsn"), use "%upcase(&dsn)"

don't make the sql server perform the upper-casing (on every row) when it applies to a constant that the macro language compiler (%upcase) could resolve (just once)

Of course probably the where clause should be something like

  %let libn =  %scan( work.&dsn, -2, . ) ;
  %let memn =  %scan(      &dsn, -1, . ) ;
  where libname eq "%upcase(&libn)" 
    and memname eq "%upcase(&memn)"

alternative method

Another method is to use:

proc contents data=WORK.example out=list(keep=NAME);
run;

This will produce a dataset called list that contains all the names from WORK.example. = paulkaefer (talk) 13:24, 13 September 2017 (CDT)