BookmarkSubscribeRSS Feed
Pups
Calcite | Level 5

 

Below is my code. I want to hide only those columns ( more then 20) after I have imported the file in the SAS format.

 

DATA work1.AAA_import;

SET work.AAA_import;

drop orgID org_name surveyID

RUN;

 

 I wrote this code . is there any other way to hide the larger number of column.

 

thank you

5 REPLIES 5
PeterClemmensen
Tourmaline | Level 20

Does your code work? And if not, what does the log say?

PaigeMiller
Diamond | Level 26

What do you mean by "hide"? Do you mean eliminate the column so it is no longer in the data set, or somehow set things up so the  column remains in the data set but isn't displayed. How do you want to view this data set with hidden columns (what specific method in SAS are you going to use to view the data set with hidden columns?)

 

If you just want the column to not appear when you look at the data set, you can create a view of the data set in PROC SQL which only will show specific columns that you select, and will not show other columns (even though those other columns are still in the data set).

--
Paige Miller
Reeza
Super User

SAS does not have a concept of 'hiding' columns. 

You can drop a column, but that removes it from the table entirely.

 

Also, this type of coding is problematic because now your original table is destroyed and to re-create it you have to re-import your data.

Don't use the same name in your DATA and SET statement unless your code is fully functioning and tested and you need to reduce space for some reason. 

 

DATA work1.AAA_import;

SET work.AAA_import;

@Pups wrote:

 

Below is my code. I want to hide only those columns ( more then 20) after I have imported the file in the SAS format.

 

DATA work1.AAA_import;

SET work.AAA_import;

drop orgID org_name surveyID

RUN;

 

 I wrote this code . is there any other way to hide the larger number of column.

 

thank you


 

anushreebiotech
Obsidian | Level 7

Hi,

 

If you don't want to use these columns anywhere in your new data set, then you use drop= option in the set statement.

 

DATA work1.AAA_import;

SET work.AAA_import (drop= orgID org_name surveyID);

run;

 

Regards,

Anushree

heffo
Pyrite | Level 9

As other has told you, hiding doesn't really exist as a concept in this case. But if you want to remove many variables at once there are some tricks. 

 

*Remove all variables between (and including) the variables named below;
data x;
	set sashelp.baseball;
	drop nAtBat--CrBB;
run;

*Remove all variables starting with cr. We can use the : as a wildcard, but only "ending with".;
data x;
	set sashelp.baseball;
	drop cr: ;
run;

*Remove all variables of one type. ;
data z;
	set sashelp.baseball;
	drop _char_ ; * or use _numeric_ ;
run;

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!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 5 replies
  • 2678 views
  • 2 likes
  • 6 in conversation