BookmarkSubscribeRSS Feed
Rsadiq1
Calcite | Level 5

 let me clarify the problem the only reason I put the put function is because of this error, how do I make my variables a character expression?

 

 

MPRINT(STEP2):   create table ALL_NPART as select distinct a.* ,b.MP_FIRSTNAME as _Fname ,b.MP_LASTNAME as _Lname ,b.indv_id
,b.MP_MANAGEDPERSONID ,b.MP_BIRTHDATE as _DOB ,b.MP_zip as _zip from outlib.MCP_QUAL as a left join refdata.xwalk_careone_crm as b
on UPCASE(COMPRESS(strip(a.PtFirst))) = UPCASE(COMPRESS(strip(b.MP_FIRSTNAME))) and UPCASE(COMPRESS(strip(a.PtLast))) =
UPCASE(COMPRESS(strip(b.MP_LASTNAME))) ;
ERROR: Function STRIP requires a character expression as argument 1.
ERROR: Function STRIP requires a character expression as argument 1.

2 REPLIES 2
ballardw
Super User

Which variable(s)?

From the error message at least 2 of

a.PtFirst

b.MP_FIRSTNAME

a.PtLast

b.MP_LASTNAME

 

are numeric. Which ones? And from the comparison your result would be comparing a text version of a numeric to a name of some sort which very few of could be written as a numeric.

 

You apparently are continuing a discussion from another thread, without reference, because there is no "PUT" in you example to see where you may have been attempting to use it.

 

SHOW some data.

Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.

 

Tom
Super User Tom
Super User

Macro generation will destroy any formatting you might have added to your code to make it readable. So let's retype the statement from your posted log and see if that makes it easier to understand what is happening.

create table ALL_NPART as 
  select distinct
         a.* 
       , b.MP_FIRSTNAME as _Fname 
       , b.MP_LASTNAME as _Lname 
       , b.indv_id
       , b.MP_MANAGEDPERSONID 
       , b.MP_BIRTHDATE as _DOB 
       , b.MP_zip as _zip 
  from outlib.MCP_QUAL  a 
  left join refdata.xwalk_careone_crm  b
    on UPCASE(COMPRESS(strip(a.PtFirst))) = UPCASE(COMPRESS(strip(b.MP_FIRSTNAME)))
   and UPCASE(COMPRESS(strip(a.PtLast))) = UPCASE(COMPRESS(strip(b.MP_LASTNAME))) 
;

So now that we can read the code it looks your problem is that your code expects that PTFIRST, PTLAST, MP_FIRSTNAME and MP_LASTNAME are character variables, which seems reasonable given their names, but unfortunately at least one of them is a number.

 

So you need to take a step back in your program's logic flow and figure out how you ended up making a variable like MP_LASTNAME as a number instead of string.

 

My bet is on using something like PROC IMPORT to guess at what types of variables to create.

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1142 views
  • 0 likes
  • 3 in conversation