I am trying to pull in results from an excel file that has a column that is free text and figure out if I word is in that text. It appears as though where the line break is within the excel file is where the data is getting cut off.
For example (in excel):
"CHOCOLATE PRESENT MANY (>30):
VANILLA PRESENT MANY (>30):
CARAMEL PRESENT MANY (>30):"
The proc import that I used is the following:
PROC IMPORT OUT= shelter_3 DATAFILE= "/shares/candy.xlsx" DBMS=xlsx REPLACE; /*SHEET="auto";*/ GETNAMES=YES; RUN;
When I see the imported file, the only line I see is the following:
"CHOCOLATE PRESENT MANY (>30):"
But if I double click I see all the text.
I then use the following pull out the flavor:
CHOC= findw(Text_field, 'CHOCOLATE');
VAN= findw(Text_field, 'VANILLA');
CARA= findw(Text_field, 'CARAMEL');
But the only once that is not zero is chocolate. It is as if the findw can't read past the line break
Would the FIND function do what you want?
Otherwise use the the FINDW as follows:
VAN= findw(text_Field, 'VANILLA', "", "S");
The S modifier adds space characters (blank, horizontal tab, vertical tab, carriage return, line feed, and form feed) to the list of characters
Would the FIND function do what you want?
Otherwise use the the FINDW as follows:
VAN= findw(text_Field, 'VANILLA', "", "S");
The S modifier adds space characters (blank, horizontal tab, vertical tab, carriage return, line feed, and form feed) to the list of characters
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.
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.