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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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
  • 4 replies
  • 611 views
  • 0 likes
  • 3 in conversation