BookmarkSubscribeRSS Feed
glmsas
Calcite | Level 5
All i'd like to do is to get a distinct count of all my vars that say start with a.
like in the data step i could use something like Keep= a: ; and it would keep all me vars that started with a.

Proc sql doesn't like the a: (like the a*) dos syntax in my SQL

any ideas to create something like this?

thanks
5 REPLIES 5
art297
Opal | Level 21
[pre]
proc sql;
select distinct count(*)
from dictionary.columns
where libname="SASHELP" and memname="CLASS" and
upcase(name) like "A%"
;
quit;
[/pre]
glmsas
Calcite | Level 5
ok, it looks as thought that query is saying that there is one col/var in that Claas table that has var that starts with a A.

what i'm tring to get is a count(distinct()) of all the values in that vars that are A%

thanks
art297
Opal | Level 21
Not sure I understand what you are looking for then. Possibly something like?:
[pre]
proc sql;
select distinct count(*)
from sashelp.class
where upcase(name) like "J%"
;
quit;
[/pre]
DBailey
Lapis Lazuli | Level 10
proc sql;
select count(distinct var)
from work.table where var like 'A%';
quit;
data_null__
Jade | Level 19
[pre]
data class;
retain ab ac ae ag 8;
set sashelp.class;
run;
proc freq data=class nlevels;
ods output nlevels=nlevels;
ods select nlevels;
tables a:;
run;
[/pre]

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3396 views
  • 0 likes
  • 4 in conversation