Does SAS allow reference of tables variables from drop-down lists?

Reply
Occasional Contributor
Posts: 6

Does SAS allow reference of tables variables from drop-down lists?

Referencing lengthy table variable names can be challenging and inefficient when manually typing the entire label.  Does SAS editor provide the functionality to invoke a drop-down list of variable names for a specified table?

Grand Advisor
Posts: 10,211

Re: Does SAS allow reference of tables variables from drop-down lists?

As a minimum it depends on which environment you are working in. SAS Studio and Enterprise guide may support what you want depending on the exact task. Base SAS doesn't except in some extremely limited places such as the Proc Report builder window. However you can access a view of the variables and characteristics  in the SAS Explorer: right click on a table and select "View Columns". This will give a window where you can copy variable names to paste into the editor.

 

You may want to be careful when mixing variable and label as in SAS terms Label is text that can be associated with a Variable but is extremely seldom actually used in programming tasks.

Occasional Contributor
Posts: 6

Re: Does SAS allow reference of tables variables from drop-down lists?

Thank you very much for your quick response to my post. Discovered that Enterprise Guide 7.12 "suggests" dataset names and dataset variable names in standard procs but not yet in PROC SQL.
Trusted Advisor
Posts: 1,114

Re: Does SAS allow reference of tables variables from drop-down lists?

[ Edited ]

Hi @Patriot1776,

 

If you must use the Enhanced Editor in Base SAS (which does not offer such drop-down lists), you could use the Enhanced Editor's abbreviation feature as a last resort:

 

The common way of using it: You type the first few letters of the long variable name and then you can complete it by pressing Enter or Tab.


An alternative way is: You type, say, v1111... and by pressing "1" repeatedly, you actually step through the list of variables of the dataset (in an order you can define, e.g., most frequently used names first) and press Enter or Tab for completion as soon as the desired name appears in the tip text (see screenshot below). You can step backwards in the list by deleting a "1" with the Backspace key.


The necessary preparations (i.e. creating all the "abbreviations" like v1=first_long_variable_name, v11=second_...) could be facilitated by creating an appropriate .reg file in a text editor. (The abbreviations are stored in the Windows registry*!)

 

abbrev.png

 

EDIT: * assuming Windows as the OS, of course.

Occasional Contributor
Posts: 6

Re: Does SAS allow reference of tables variables from drop-down lists?

Thank you very much for your quick response to my post.  Discovered that Enterprise Guide 7.12 "suggests" dataset names and dataset variable names in standard procs but not yet in PROC SQL.

Ask a Question
Discussion stats
  • 4 replies
  • 292 views
  • 0 likes
  • 3 in conversation