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 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!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 4346 views
  • 8 likes
  • 4 in conversation