BookmarkSubscribeRSS Feed
AliJ
Calcite | Level 5

Thanks a lot !  data_null_ and cwilson. it really work well.

RichardinOz
Quartz | Level 8

Here's another suggestion if you have differing numbers of commas in column A.

Create an array of your desired variables, then

Create an array of character variables t1 - tM where M = number of input variables (n) + maximum number of commas.

The length of each temporary variable must exceed the length of any input variable.

Input the data into the variables t1 - tM as text.

if t{n+1} is not blank then

t1 = catx (', ', t{1}, t{2}) ;

t{2} = t{3} ; etc to t{M-1} = t{M} ;

repeat until t{n+1} is blank

copy values to the array of desired values

Drop all the t{*} values

Use  do while () or do until () to loop until t{n+1} is blank

Use do k = 1 to n  to copy values from the t{*} array to the wanted values

Do any text to numeric conversion en route as required

Richard

Ksharp
Super User

Maybe your csv file is not real CSV file. Use double quote around it .

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 17 replies
  • 4386 views
  • 8 likes
  • 8 in conversation