BookmarkSubscribeRSS Feed
Mirisage
Obsidian | Level 7
Hi Colleagues,

The data set now I am working with having over 1500 variables. I know the names of each and every variables based on data dictionary but could you let me know how to locate a given variable immediately.

I tried Ctrl + F approach like in Excel but doesn't work.

Thanks

Mirisage
7 REPLIES 7
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Please help by explaining from where you want to do your "variable find" command?

You can use PROC CONTENTS and do a FIND in the OUTPUT window, as one idea.

Scott Barry
SBBWorks, Inc.
Mirisage
Obsidian | Level 7
Hi sbb,

Thanks.

I need to find a given variable in an opened SAS dataset itself. Say you open a SAS dataset, and you need to find the 'age' variable quickly to get some understanding how do the records under that variable look like.

If there is no quick way to find it, I have to go all variables one by one along headline (first raw) of the data set.

Thanks

Mirisage
Cynthia_sas
SAS Super FREQ
Hi:
I don't understand where the SAS dataset is opened -- in Enterprise Guide?? In the Viewtable window from the SAS Explorer??

For data exploration, I find the best method of reviewing data is to use something like PROC MEANS or PROC UNIVARIATE for numeric variables and to use PROC FREQ for character variables.

Something like the program below, using SASHELP.CLASS.

cynthia
[pre]
ods html file='c:\temp\explore.html' style=sasweb;
** Run the procedures with only your variable of choice;
proc freq data=sashelp.class nlevels;
title '1a) Look at Specific Variable';
tables age;
run;

proc univariate data=sashelp.class;
title '1b) Look at AGE with Univariate';
var age;
run;

proc means data=sashelp.class;
title '1c) Look at AGE with Proc MEANS';
var age;
run;

** Alternately, Explore all character and numeric variables in one procedure;
proc freq data=sashelp.class nlevels;
title '2a) Look at all Character Variables';
tables _character_;
run;

proc univariate data=sashelp.class;
title '2b) Look at Numeric Variables with Univariate';
var _numeric_;
run;

proc means data=sashelp.class;
title '2c) Look at Numeric Variables with Proc MEANS';
var _numeric_;
run;
ods html close;
[/pre]
Mirisage
Obsidian | Level 7
Hi Cynthia,

SAS dataset is opened in the Viewtable window from the SAS Explorer.

The first row is like this which shows variable names.

ID Age Sex Occupation Income Land_owned Disabled Weight............and so on

Say I want to jump into the 'Disabled' variable at once. How should I do it?

Thanks

Mirisage
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
With SAS 9.1.3, I observed a few options - right-click the object, then click VIEW_COLUMNS, or open the file and then click EDIT, then FIND.

Scott Barry
SBBWorks, Inc.
ChrisNZ
Tourmaline | Level 20
You can also use the form view if you want to show more variables at once (though it has display issues with long variables). There is also the hide/unhide tool, and the hold option to keep some variables permanently displayed when you scroll, but to be honest this interface is obsolete (which is a shame as it is really useful). For eg, the find field in "view columns" requires you to know and enter the whole variable name, or the hide/unhide dialog is tiny and only shows the first eight letters of the variable names. And there is no Goto option to go to a column or to a row/value.

With FSView, you can type 85 to go to row 85, and both goto options are there, but this was not carried over to viewtable.

I raised these issues years ago with tech support, but nothing happened.

Try fsview see if the "go to variable" menu entry works for you. Be warned though, if you have no mainframe experience, the looks and (lack of) features may frighten you ;o)
Peter_C
Rhodochrosite | Level 12
since that is now classified as "the old-fashioned sas", you may have the old-fashioned sas module called fsview and fsbrowse. These allow you to go directly to a variable ("disabled" in the example below) with the command
=disabled

Pity it's not so easy in the "more up-to-date" SAS

PeterC

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 7 replies
  • 2824 views
  • 0 likes
  • 5 in conversation