BookmarkSubscribeRSS Feed
rajeshalwayswel
Pyrite | Level 9
Example: I'm having a variable with this value I need to split every variable with 20 length for suppose no variable value split with like "bother" ------both in one variable and ther into other variable ("But I don't see why you need to bother won't the consumer of your XPORT file just glue the cut up text back together in one variable. You could even supply the program.") Required Output: every vairble with 20 length no split words col1 -----But I don't see why you need to bother col2------won't the consumer of your XPORT col3---------file just glue the cut up text back together in col4-----one variable. You could even supply the program.")
5 REPLIES 5
Reeza
Super User
Post sample data and what you’ve tried so far.  Your question is ambiguous. I’m not sure if that’s due to the forum being messed up, English or not taking the time to properly phrase and illustrate your issue.  FYI - there are solutions to this problem on this site and lexjansen.com
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Your post makes no sense.  Supply, per the guidance found when you post a question, test data in the form of a datastep, what the output should look like, any logic which may happen.  Also post any code you have tried as this is not a contract work forum but a Q&A.

 

Do also note that yesterday there was an issue with the forum, you should now be able to use RichText box with code windows - {i} above post area - and proper formatting to show clearly what you want.

rajeshalwayswel
Pyrite | Level 9
sorry for everything if make any make inconvenience to other...
ChrisNZ
Tourmaline | Level 20

You really really need to format your questions better. A big lump of text is just lazy.

From what I understood:

data HAVE;
  length VAR $100 ;
  array COL [6]  $20;
  VAR='But I don''t see why you need to bother won''t the consumer of your XPORT file just glue the cut up ';
  START=1;
  do C=1 to 6;
    END=find(VAR,' ',-START-20);
    COL[C]=substr(VAR, START, END);
    START=END;
  end; 
run; 
COL1 COL2 COL3 COL4 COL5 COL6
But I don't see why you need to bother won't the consumer of your XPORT file just glue the cut u up

 

I let you sort out the behaviour when reaching the end of the string if  the above is too basic. 

rajeshalwayswel
Pyrite | Level 9
Thanks...One more thing is in col5 we don't split word we need full word that needs to come in column and while running in 9.4 we have some notes.... I'll explain clear in next time of my questions...

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 5 replies
  • 690 views
  • 0 likes
  • 4 in conversation