DATA Step, Macro, Functions and more

creating a data set with different delimiters

Accepted Solution Solved
Reply
New Contributor
Posts: 3
Accepted Solution

creating a data set with different delimiters

I'm just learning SAS and was presented with a .txt data file that has tab and space delimiters for varying lengths of city names and months.  Is there an easy way to code this is SAS to format all the same for variables and obs?  The only thing I could think to do was manually tab out the whole doc to avoid figuring out how to do it in SAS but I feel like that probably isn't the right solution.  Thanks!


Accepted Solutions
Solution
Thursday
Super User
Posts: 23,262

Re: creating a data set with different delimiters

You can specify multiple delimiters, but are you sure a space is a delimiter?

https://communities.sas.com/t5/Base-SAS-Programming/Input-datalines-with-tab/m-p/445667/highlight/tr...

 


@jillf78 wrote:

I'm just learning SAS and was presented with a .txt data file that has tab and space delimiters for varying lengths of city names and months.  Is there an easy way to code this is SAS to format all the same for variables and obs?  The only thing I could think to do was manually tab out the whole doc to avoid figuring out how to do it in SAS but I feel like that probably isn't the right solution.  Thanks!


 

View solution in original post


All Replies
Solution
Thursday
Super User
Posts: 23,262

Re: creating a data set with different delimiters

You can specify multiple delimiters, but are you sure a space is a delimiter?

https://communities.sas.com/t5/Base-SAS-Programming/Input-datalines-with-tab/m-p/445667/highlight/tr...

 


@jillf78 wrote:

I'm just learning SAS and was presented with a .txt data file that has tab and space delimiters for varying lengths of city names and months.  Is there an easy way to code this is SAS to format all the same for variables and obs?  The only thing I could think to do was manually tab out the whole doc to avoid figuring out how to do it in SAS but I feel like that probably isn't the right solution.  Thanks!


 

New Contributor
Posts: 3

Re: creating a data set with different delimiters

Thank you.  I realized the formatting was off in my original download.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 84 views
  • 0 likes
  • 2 in conversation