variable length field

Occasional Contributor
Posts: 18

variable length field

Hi I have a city,state field - variable length.  I need to output the city and in another field output the state field.  Basically have one field but need to output two fields but it is variable:  For example:  New York, NY

                                                                                           Rye, NY

                                                                                           White Plains, NY

Esteemed Advisor
Posts: 6,646

Re: variable length field

Use the scan() function. Like


city = scan(city_state,1,',');
state = scan(city_state,2,',');

Take care of defining the target fields with appropriate lengths.


Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation