BookmarkSubscribeRSS Feed
DLROW
Quartz | Level 8

Hi - How to hide Obs column in proc sql. Thanks.

16 REPLIES 16
PaigeMiller
Diamond | Level 26

Exactly what are you looking at when you see an OBS column in PROC SQL? Please show us a screen capture.

--
Paige Miller
DLROW
Quartz | Level 8

I get the obs column number as 1 2 3 4 ...for each row. When the report is exported to excel I get the number. Please see the attached. Thanks.

 

Example : 

 

       field name1     fieldname2      fieldname 3

1      value             value               value 

2      value             value                value 

3      value            value               value 

4      value           value                 value 

5       value         value                value 

Tom
Super User Tom
Super User

I don't understand. You posted a picture of something in a SAS browser window.

Not a dataset. Not an output. Not an Excel file.

DLROW
Quartz | Level 8

Attached again. Can you see the output?

PaigeMiller
Diamond | Level 26

Many of us will not (or cannot) download and open Microsoft Office documents because they are security risks. Better to include the screen capture in your reply, by clicking on the "Photos" icon.

--
Paige Miller
Tom
Super User Tom
Super User

Again that just looks like a photo of the data browsing window in SAS/Studio. 

DLROW
Quartz | Level 8

 

I see the screen shot if I download it though.

 

If you run the below code you could see the  obs number (1st column) 1 2 3 4 ..I want to get rid of those numbers.

 

proc sql nonumber;
create table test as select * from sashelp.class;
run;

Tom
Super User Tom
Super User

@DLROW wrote:

 

I see the screen shot if I download it though.

 

If you run the below code you could see the  obs number (1st column) 1 2 3 4 ..I want to get rid of those numbers.

 

proc sql nonumber;
create table test as select * from sashelp.class;
run;


Nope. It DOES NOT create any OBS NUMBER variable.

It makes the exact same dataset as if you just used a normal data step.

data test2;
 set sashelp.class;
run;
DLROW
Quartz | Level 8

Yes, it is not a variable but we do see the row numbers as 1 2 3 .... before the column 'Name'.

 

output :

      Name Sex Age Height Weight

1    Alfred M 14 69 112.5

2    Alice F 13 56.5 84

3    Barbara F 13 65.3 98

Tom
Super User Tom
Super User

You are looking at a screen designed to let your browse a dataset. That does not have anything to do with PROC SQL or anything to do with OUTPUT.

 

If you open an Excel file in Excel it will also show you line numbers (and column letters). 

image.png

 

If you want the observation number to not show in output then use appropriate options for that.  NOOBS in PROC PRINT and NONUMBER in PROC SQL.

image.png

image.png

DLROW
Quartz | Level 8

Thanks for your reply Tom. 

 

Have you created the stored process and run the report from SAS Report tab (through EXCEL SAS ADDIN) ? If so , please try that. 

How do you attach the results here. I am not able to.

 

r_behata
Barite | Level 11
proc sql nonumber;
select * from sashelp.class;
run;
DLROW
Quartz | Level 8

Still I get the number if I create the table. When this report is run from  SAS Reports (Excel SAS Addin)  this number is also being populated in an excel.

 

 

Code:

proc sql nonumber;
create table test as select * from sashelp.class;
run;

 

Tom
Super User Tom
Super User

Not sure what the add-in to Excel is doing. But if you are using Excel shouldn't your screen shot look like an Excel sheet?

Also your code does NOT look like a report. It is just a step to create a dataset.  Nothing in that code to produce any report to be copied to Excel.

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!

Discussion stats
  • 16 replies
  • 3409 views
  • 0 likes
  • 4 in conversation