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

hello team,

I have a proc sql:

 

proc sql noprint;

select nobs into :TOTOBS separated by " " from dictionary.tables

where libname = "work" and ...

quit;

(To some extend I know what dictionary tables are)

How can we view the  dictionary tables and find out what the variables are?

Why does it say separated by " "?

Regards,

blueblue

Blue Blue
1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

You view them the same way you view any other SAS data sets (the exact answer depends on what SAS interface you use)

 

You can view macro variable &TOTOBS via

 

%put &=TOTOBS;
--
Paige Miller

View solution in original post

11 REPLIES 11
PaigeMiller
Diamond | Level 26

Dictionary.TABLE is data set SASHELP.VTABLE

Dictionary.columns is data set SASHELP.VCOLUMN

Dictionary.FunkAndWagnalls is data set ... um ... nevermind ...

 

libname="work" never works because the dictionary tables contain uppercase libnames and data set names (memnames)

 

separated by " " creates a macro variable named TOTOBS that is not the total or the sum, but the number of observations (variable nobs) in each data set (as a character string) appended to each other and separated by a blank, kind of useless if you ask me.

--
Paige Miller
GN0001
Barite | Level 11

Hello,

I am grateful to your response:

I can't figure out what you mean by saying:

Dictionary.TABLE is data set SASHELP.VTABLE

Dictionary.columns is data set SASHELP.VCOLUMN

 

TOTOBS that is not the total or the sum, but the number of observations (variable nobs) in each...

What would be TOTOBS for the first observation in dataset A which has 30 rows?

Regards,

blueblue

Blue Blue
PaigeMiller
Diamond | Level 26

Seems pretty obvious to me. The dictionary tables are SAS data sets. 

 

Can you please be much more specific about your question?

--
Paige Miller
GN0001
Barite | Level 11

Hello PaigeMiller,

 

Can you please let me know how I can view this below?

 

Dictionary.TABLE is data set SASHELP.VTABLE

Dictionary.columns is data set SASHELP.VCOLUMN

 

Can you please let me know how I can view this below?

libname="work" never works because the dictionary tables contain uppercase libnames and data set names (memnames)

 

Can you please let me know how I can view this below? I worked for hard to see totobs for each observation on the log but I couldn't. What would be the totobs for observation 1?

 

separated by " " creates a macro variable named TOTOBS that is not the total or the sum, but the number of observations (variable nobs) in each data set (as a character string) appended to each other and separated by a blank, kind of useless if you ask me.

 

Respectfully,

blueblue

Blue Blue
PaigeMiller
Diamond | Level 26

You view them the same way you view any other SAS data sets (the exact answer depends on what SAS interface you use)

 

You can view macro variable &TOTOBS via

 

%put &=TOTOBS;
--
Paige Miller
GN0001
Barite | Level 11

Hi,

 

%put &=totoobs saved my life.

Author of the code had: %put number of records = &totobs.

when I run the code, I don't see anything except static for %put number of records = &totobs.

he has printto as well. I commented out that part.

 

What is the rule to see everything on the log? I look into log to find out the code but most of the time, the log doesn't say very much.

Regards,

blueblue

Blue Blue
PaigeMiller
Diamond | Level 26

@GN0001 wrote:

Hi,

 

%put &=totoobs saved my life.

Author of the code had: %put number of records = &totobs.

when I run the code, I don't see anything except static for %put number of records = &totobs.

he has printto as well. I commented out that part.

 

What is the rule to see everything on the log? I look into log to find out the code but most of the time, the log doesn't say very much.


 

All of this is unspecific and impossible to answer. Whenever the code isn't working (now and 100% of the time in the future), you need to SHOW US the log that you are seeing, including everything, including the code as it appears in the log, plus any WARNINGs, ERRORs, NOTEs. Do not pick and choose parts of the log to show us, show us ALL of log for this batch of code.

 

Paste the log as text (not as a screen capture) into the window that appears when you click on the </> icon. DO NOT SKIP THIS STEP.

--
Paige Miller
GN0001
Barite | Level 11
Hi Paige Miller,
Do we have other options that show us values on SAS Log?
Respectfully,
blueblue
Blue Blue
GN0001
Barite | Level 11

Hello,

Are there other ways to view values in log?

Most of the time, I can see values are not shown on log, it is code only. Other than loops, I can't see anything else on the log.

Regards,

blueblue

Blue Blue
GN0001
Barite | Level 11

Sorry I forgot to mention that I use SAS enterprise guide.

Regards,

blue blue

Blue Blue
FreelanceReinh
Jade | Level 19

Hello @GN0001,

 

Just to add:

You can also use the DESCRIBE statement of PROC SQL to find out the variable names of one or more dictionary tables:

proc sql;
describe table dictionary.tables, dictionary.columns /* ... */;
quit;

See the documentation Accessing SAS Information By Using DICTIONARY Tables for the list of table names, the corresponding views in SASHELP and more information.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 11 replies
  • 2865 views
  • 7 likes
  • 3 in conversation