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-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!

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