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

Hi, was struggle about how to hide the created variable column from the table.

I don't want it to be shown in the table but I want to use it for calculations afterwards.

 

Foe example, the variable column that I have created is

 

yearcount=zclmpd+1

 

I don't want my table show the yearcount variable.

 

How can I solve this problem? isit by using %let statement?

1 ACCEPTED SOLUTION

Accepted Solutions
5 REPLIES 5
KachiM
Rhodochrosite | Level 12

Use 

drop yearcount;

Amir
PROC Star

Have you considered creating a view with just the columns you want to see?

 

Some examples are shown in the SAS documentation:

 

https://documentation.sas.com/?docsetId=sqlproc&docsetTarget=n0nolnbokay91in1gouzgw3xzl5e.htm&docset...

 

The original table will still have the yearcount variable for you to use later.

 

Amir.

 

 

PaigeMiller
Diamond | Level 26

@Kayla_Tan222 wrote:

I don't want my table show the yearcount variable.

 


What method in SAS you are you using to "show" the data? Please be specific.

 

For example, PROC PRINT and PROC REPORT allow you to show any columns you want and leave out any other columns you don't want. Also, as mentioned by @Amir you can use PROC SQL to create a view with only selected columns and then VIEWTABLE (for example) shows only the columns selected.

--
Paige Miller
Ksharp
Super User

Create a VIEW and show it to your colleague .

 

proc sql;

create view want as

 select a,b,c,d

   from have;

quit;

Tom
Super User Tom
Super User

It is not at all clear what you are trying to do.  You cannot "hide" a variable.  But there is no reason why you need to "show" variables other than the ones you want.

 

How are you showing the data? 

If you are using a PROC then only list the variables you want. 

proc means;
  var a b c ;
run;

Or drop the variable you don't want. 

proc print data=mydata (drop=yearcount);
run;

Some procedures, like PROC REPORT, can let you use a variable to control the report but not display the variable's value in the report.

define yearcount / noprint ;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 3705 views
  • 0 likes
  • 6 in conversation