BookmarkSubscribeRSS Feed
juliajulia
Obsidian | Level 7

Dear Expert:

i want to compare the format, label and variable names in two dataset. and i used the following code to do it. the code work very well for two of my compared datasets but the same code didn't work for another two compared dataset. there is no error message but log says  : "No observations were selected from data set SASHELP.VCOLUMN." . i just can't figure out the reason that caused this issue. please advise.

data work.g2020;
set rsrbase0.g2020;
run;
data work.g2021;
set rsrbase1.g2021;
run;

proc tabulate data=sashelp.vcolumn;
title "compare name and types";
where libname='WORK' and memname in ('g2020' 'g2021');
class memname name type ;
table name*type,
memname
;
run;

 

I used the same code for another two dataset and works well:

data work.c2020;
set rsrbase0.c2020;
run;
data work.c2021;
set rsrbase1.c2021;
run;

proc tabulate data=sashelp.vcolumn;
title "compare name and types";
where libname='WORK' and memname in ('c2020' 'c2021');
class memname name type ;
table name*type,
memname
;
run;

3 REPLIES 3
sbxkoenk
SAS Super FREQ

Hello,

 

I do not know SASHELP.VCOLUMN very well.

Instead I always use PROC SQL with the dictionary.columns dataset.

But SASHELP.VCOLUMN is a view on this dictionary.columns dataset (the latter you can only access via PROC SQL).

 

In dictionary.columns the libname and memname column are all in uppercase.

 

Therefore, I would recommend you try uppercase notation :

    where libname='WORK' and memname in ('C2020','C2021');

instead of

    where libname='WORK' and memname in ('c2020' 'c2021');

 

Probably that is the solution to your problem.

 

Thanks,

Koen

Kurt_Bremser
Super User

I seriously doubt that this has ever worked:

where libname='WORK' and memname in ('c2020' 'c2021');

Why? Memnames for Base SAS libraries are always uppercase in the DICTIONARY tables. So it has to be

where libname='WORK' and memname in ('C2020' 'C2021');
ballardw
Super User

Libname and Memname are stored in the views in upper case. But variable names are not. You may want to consider creating a data set so that you can apply UPCASE , or Lowcase, to the Name of variables so that Proc Tabulate will treat names that differ in case as the same variable for the report.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 3 replies
  • 674 views
  • 4 likes
  • 4 in conversation