BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I am working from time to time with very large datasets and I was wondering if there is a way to fuzzy search using PROC CONTENTS or some other method to list specific fields matching one criteria or another.

Of course the fallback way is to just do a CTRL-F but that is really inefficient when you have dataset with two thousand variables.

TX
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
Do you mean something like this:
[pre]
proc sql;
create table work.varlist as
select libname, memname, name, type, label, format
from dictionary.columns
where upcase(libname) = 'SASHELP' and
upcase(memname) = 'SHOES' and
name contains 'ry';
quit;

proc print data=work.varlist;
title 'Variables from SASHELP.SHOES that contain the string "ry"';
run;
[/pre]
and the output from the job is:
[pre]
Variables from SASHELP.SHOES that contain the string "ry"

Obs libname memname name type label format

1 SASHELP SHOES Subsidiary char
2 SASHELP SHOES Inventory num Total Inventory DOLLAR12.

[/pre]

In this example, the search is for something about the variable NAME as the selection criteria.
On the other hand, you may actually want to find something about a variable value using a search -- which would require reading the actual file itself instead of dictionary.columns.

cynthia

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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
  • 1 reply
  • 667 views
  • 0 likes
  • 2 in conversation