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?
Use
drop yearcount;
Have you considered creating a view with just the columns you want to see?
Some examples are shown in the SAS documentation:
The original table will still have the yearcount variable for you to use later.
Amir.
@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.
Create a VIEW and show it to your colleague .
proc sql;
create view want as
select a,b,c,d
from have;
quit;
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 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.