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]

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register 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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 949 views
  • 0 likes
  • 4 in conversation