05-26-2016 04:57 PM
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?
05-26-2016 05:13 PM
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.
05-31-2016 01:02 PM
05-26-2016 05:55 PM - edited 05-26-2016 05:59 PM
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*!)
EDIT: * assuming Windows as the OS, of course.
05-31-2016 12:59 PM
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.