BookmarkSubscribeRSS Feed
Patriot1776
Fluorite | Level 6

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?

4 REPLIES 4
ballardw
Super User

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.

Patriot1776
Fluorite | Level 6
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.
FreelanceReinh
Jade | Level 19

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.

Patriot1776
Fluorite | Level 6

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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 777 views
  • 0 likes
  • 3 in conversation