BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Junyong
Pyrite | Level 9

Sometimes I need to see specific observations in large data sets. For example,

data have;
do i=1 to 100000;
x=rannor(1);
y=x+rannor(1);
output;
end;
run;

And suppose I want to see the 12,345th observation in the 100,000-observation data set as follows.

1.png2.png

Usually I use (1) the page-up and page-down keys or (2) the up-arrow and down-arrow keys, or (3) drag the right scroll bar. In Excel I can use the F5 key to go to specific cells. I wonder whether SAS has something similar, both vertically and horizontally, though the above example is only a vertical case. 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

If you have the Viewtable open you can use Ctrl-F to bring up a search window that you can use to indicate a variable and value to search for.

 

If you want a command in the SAS command box you can type:

vt have; find i=75;

note the ; to delimit commands. The box will open with that line.

 

If you don't have a variable you can try:

vt have; forward 75;

The first time the VT window opens it would go forward (toward the end of the file) 75 lines. However it is not a row number reference.

 

If you expect this to be opened in code then you use the DM command:

 

dm "vt have; find 75;";

or

dm "vt have; forward 75;";

 

If the data set you want is the last created one you could use _last_ in place of the data set name.

 

There isn't really anything similar for variables. There is a COLUMNS command that can show the list of given variable names (only).

That would look like

vt have; columns ' i y';

or if you have VT open the Columns in the command box (that first box on the left in the menu bar next to the check mark)

You could use HIDE or UNHIDE as well to manipulate the current variables shown.

 

View solution in original post

5 REPLIES 5
ballardw
Super User

If you have the Viewtable open you can use Ctrl-F to bring up a search window that you can use to indicate a variable and value to search for.

 

If you want a command in the SAS command box you can type:

vt have; find i=75;

note the ; to delimit commands. The box will open with that line.

 

If you don't have a variable you can try:

vt have; forward 75;

The first time the VT window opens it would go forward (toward the end of the file) 75 lines. However it is not a row number reference.

 

If you expect this to be opened in code then you use the DM command:

 

dm "vt have; find 75;";

or

dm "vt have; forward 75;";

 

If the data set you want is the last created one you could use _last_ in place of the data set name.

 

There isn't really anything similar for variables. There is a COLUMNS command that can show the list of given variable names (only).

That would look like

vt have; columns ' i y';

or if you have VT open the Columns in the command box (that first box on the left in the menu bar next to the check mark)

You could use HIDE or UNHIDE as well to manipulate the current variables shown.

 

Junyong
Pyrite | Level 9

forward is exactly what I wanted—columns is also useful.

May I add a little silly question? I have used SAS more than five years and sometimes use dm functions such as log;clear;output;clear; but have never though about the command box. Where can I more find the command box functions?

ballardw
Super User

@Junyong wrote:

forward is exactly what I wanted—columns is also useful.

May I add a little silly question? I have used SAS more than five years and sometimes use dm functions such as log;clear;output;clear; but have never though about the command box. Where can I more find the command box functions?


The SAS documentation. Search for Command.

Or topics like VIEWTABLE.

Ksharp
Super User
data have;
do i=1 to 100000;
x=rannor(1);
y=x+rannor(1);
output;
end;
run;

data temp;
 n=12345;
 set have point=n;
 output;
 stop;
 run;
 
 proc print noobs;run;
FreelanceReinh
Jade | Level 19

Hello @Junyong,

 

In my opinion, the SAS Universal Viewer is superior to a VIEWTABLE window when it comes to viewing SAS datasets. One of its advantages is that it doesn't lock the datasets being viewed (see, e.g., this thread: Close all VIEWTABLES). And of course it has the "Go to row ..." feature:

UV_go_to_row.png

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 5 replies
  • 3533 views
  • 8 likes
  • 4 in conversation