BookmarkSubscribeRSS Feed
sasuser381
Obsidian | Level 7

Is there any way to get the list of all columns in a project which are being used? Sashelp.vcolumn will give me all columns from certain tables, not only the ones i used in queries and programs.

6 REPLIES 6
Mar1ene
Obsidian | Level 7

Hello sasuser381 (creative name ;P),

 

if you use

 

proc contents data=TABLE_NAME; run;

 

you get the table (specified) column names and attributes... is this what you're looking for?

 

Alphabetic List of Variables and Attributes# Variable Type Len Format Label
4EMP_BANDSChar9$9.EMP_BANDS
2INCOME_BANDSChar7$7.INCOME_BANDS
5INT_RATE_MARGIN_BANDSChar18$18.INT_RATE_MARGIN_BANDS
1LOAN_BANDSChar8$8.LOAN_BANDS
6Loan_AmountNum818.2Loan Amount
7NNum8 N

 

Marlene

RW9
Diamond | Level 26 RW9
Diamond | Level 26

SASHELP.VCOLUMNS will only give you columns where libnames have been assigned, i.e. only if SAS Knows about the tables can it give the information.  Some further information would be useful.  What "project" - i.e. what software are you using.  Do you have some sort of setup file?

sasuser381
Obsidian | Level 7

I use SAS EG 7.1. and most of the project is done in query buliders or in a custom program. Can i get the list of all colums that are used in in, without running the project?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

I don't believe so.  This is a very good reason why you should document your whole process before even starting to code.  No point trying to patch it up afterwards.  

Run the whole project putting proc scaproc on before will get you all the inputs outputs, and the log will show what code is run.  Have fun trying to patch it all together though, you will find out why documenting before even coding is required.

Reeza
Super User

Not that I know of. And if you used any select * or SET it somewhat implies that you've used the entire data set. You can try PROC SCAPROC but I don't think it goes down to that level either. 

 


@sasuser381 wrote:

Is there any way to get the list of all columns in a project which are being used? Sashelp.vcolumn will give me all columns from certain tables, not only the ones i used in queries and programs.


 

Mar1ene
Obsidian | Level 7

Maybe this is useful in what you want to achieve.

 

http://bi-notes.com/2012/10/sas-code-show-sas-macro-variables/ 

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
  • 6 replies
  • 1229 views
  • 3 likes
  • 4 in conversation