BookmarkSubscribeRSS Feed
claremc
Obsidian | Level 7

Hello, 

 

I realized that people with middle names or suffixes in my data, i.e.: "Jane Doe PHD" or "Bob Scott Jr" are getting their data pushed so that for only these people, all of their data is being shifted one column to the left. This is only happening to these people, and my dataset comes from an outside source library (and cannot changed from the source).  The solutions I've seen are mainly related to changing data when you in the infile statement when you load the data in, which is not possible for me. Let me know, thanks! 

 

Again, I want to do something like this : 

if index(First_name2, "JR" "PHD") then [SOMEHOW-SHIFT-LEFT COLUMNS 4 THRU 11];
1 REPLY 1
ErikLund_Jensen
Rhodochrosite | Level 12

Hi @claremc 

We need a listing of the variable attributes, because values should be moved from one variable to another, so differences in variable lengths and types might be a problem. So please submit the code "proc contents data=mylib.myinput; run;" and post the result.

 

It would also be a help to have a data sample, ex. the result of "proc print data=mylib.myinput(obs=10); run;". 

 

And a tip: To check for the occurrence of texts like "JR" or "PHD" is not the best way of finding the erroneus observations. It would be better to look at the variables 5-11 to see if a zip-code or other easily recognizable value is present in e.g. v8 or v9, or to check for non-missing values in v11, but that would only work if there are non-missing values in all observations. 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 345 views
  • 0 likes
  • 2 in conversation