Hi, How can I split this text into multiple columns:
"TEST","N/A","Week One","Disabled","Disabled","Disabled","Disabled"
"TEST","N/A","MON, TUE, WED, THU, FRI","Disabled","Disabled","Disabled","Disabled"
"TEST","N/A","Week One","Disabled","Disabled","Disabled","Disabled"
"TEST","N/A","Stop On Battery Mode, No Start On Batteries","Disabled","Disabled","Disabled","Disabled"
The result in this example should be 7 columns
| TEST | N/A | Week One | Disabled | Disabled | Disabled | Disabled |
| TEST | N/A | MON, TUE, WED, THU, FRI | Disabled | Disabled | Disabled | Disabled |
| TEST | N/A | Week One | Disabled | Disabled | Disabled | Disabled |
| TEST | N/A | Stop On Battery Mode, No Start On Batteries | Disabled | Disabled | Disabled | Disabled |
So this text is in a single variable now? Or is this in a separate file?
In a SAS data set, correct? Not an external file like csv?
Sas Data looks like
From where does that data originate? This clearly looks like a line from a CSV file, so it should be read initially as such.
Then you can do it right there:
data want;
infile "schtasks /fo csv" pipe dlm="," dsd end=eof;
input
name :$10.
var2 :$5.
when :$40.
var4 :$10.
var5 :$10.
var6 :$10.
var7 :$10.
;
run;
Adapt variable names and formats as needed.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.
Find more tutorials on the SAS Users YouTube channel.