I am fairly new to using SAS and have a project to upload 100 SAS data sets to SQL server with their meta data or their complete data dictionaries. I am using SAS 9.4. I transferred SAS data sets to SQL as only raw data files with no data labels. So, I need to extract a comprehensive data dictionary for all data sets in the library. The dictionary includes at least variable/column names, variable/column labels, value labels, variable/column type. Example of displaying variable Gender is:
Variable/Column name = GenderTyp
Variable/Column Label=GenderTyp
Value Labels = 2='Female' 1= 'Male'
Variable/Column Type=Char
Proc content will give me all info I need but Value Labels. Same with Proc SQL; select dictionary.column;
How do I get Value labels? Attached file shows here is how Gender is stored in the demographic data set.
Thank you,
Thank you Reeza.
Hi Reeza,
I am still struggling to get values or value labels off my SAS data sets. Using your suggestion for a single variable in the data set will give me the followings. First here is the code:
Proc SQL;
select *
from sashelp.vcolumn
where libname="CENCD" and name='Anger_37_C';
Quit;
The output is attached (Figure 1). The only info I need for this variable is Column Name and Label+ value(or valuer labels). If I run a simple Frequency for this variable, I get the output (Figure 2 in the attached Excel file). So, my question is how can I get something like this:
Name Labels Value
Anger_37_C TBIQOL Anger: became verbally abusive? Always, Missing, Never, Often, Rarely, Sometimes
For all variable sin the data set. In the case of this variable, it looks like there is no actual Value Labels like 1= Always, 2=Sometimes, etc....rather it's the actual Character. I hope my question is clear.
Thank You
If I understood correctly, I have to have Format files in order to use vformat and cntlout but there no format files. The macro has helped though except it produces observations as well that I don't need and I am not savvy to change the macro and get remove the observation piece. Anyway, thank you for sharing the macro with me.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.