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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.