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 .

sas-innovate-2024.png

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.

 

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.

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
  • 17 replies
  • 2344 views
  • 8 likes
  • 8 in conversation