BookmarkSubscribeRSS Feed
ncsthbell
Quartz | Level 8

I am creating a stored process that will have 5 different prompts defined. All are character except for one, ‘DISTRICT’.   The user wants to be able to leave the ‘DISTRICT’ column blank and return all the observations, no matter what the numeric value of DISTRICT is.

 

I defined the prompt as a numeric type in SMC but cannot figure out how to handle it in the code/select statement.  Basically, it is like a wildcard on a character type column but on a numeric column.

 

This is one of my character type prompts. No matter what value is entered, a '%' for wildcard is added.

call symput("NEW_REGION_CD","'"||"&REGION_CD"||"%'");

 

Can't figure out how to do this same thing for prompt that is numeric.

 

Any assistance would be appreciated!!!

2 REPLIES 2
Reeza
Super User

 

There isn't a wild card for numbers though.

 

You'd have to provide an example of how this would be used in the queries for us to offer suggestions.

ncsthbell
Quartz | Level 8

Sorry, here is a short example of my code.  The first statement on the 'where; clause is the numeric 'DISTRICT' column.  All others are character and work.

PROC SQL;
CREATE TABLE WORK.DATA_SELECTED AS 
	(SELECT 
		t1.DISTRICT,
		t1.OFFICE_NAME,
		t1.OFFICE_LOCATION
t1.OFFICE_MANAGER
		t1.NBR_EMPLOYEES,
		t1.COUNTY_NAME, 
		t1.ADDR_LINE_1, 
		t1.ADDR_LINE_1, 
		t1.CITY, 
		t1.STATE, 
		t1.ZIP
	    FROM  mylib.t1 DISTRIC_INFO
	    WHERE t1.District = &NEW_district
and t1.Office_Name LIKE &NEW_OFFICE_NAME
and t1.State = &NEW_STATE
and t1.County_Name = &NEW_COUNTY
and t1.City = &NEW_CITY
and t1.Zip = &NEW_ZIP );
QUIT;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2 replies
  • 1225 views
  • 0 likes
  • 2 in conversation