BookmarkSubscribeRSS Feed
librasantosh
Obsidian | Level 7
Yes my data is in txt file and its not arranged in order. Is there any solution to create dataset without putting '.' for missing values in raw data. Data values are not arranged in neatly defined columns, but are separated by at least one space and contain some nonstandard characters, such as the dollar sign ($)
Kurt_Bremser
Super User

If an external text file is not structured in a way that lets you detect missing values, return to sender. As soon as you have two numerics in succession, there is no way for you to detect which one shall be set to missing. I know of no software that would export data in such a stupid way, even MS Excel manages to get that right.

 

Are you sure you made no mistake when copy/pasting to the data step?

librasantosh
Obsidian | Level 7

Hi, thanks for reply,

 

I am trying this way 

 

proc import datafile="C:\file path.txt" 

            dbms=dlm

            out=new data

            replace;

     delimiter='|';

     getnames=yes;

 guessinrows=100;

 

run;

 

Its working. 

Kurt_Bremser
Super User

@librasantosh wrote:

Hi, thanks for reply,

 

I am trying this way 

 

proc import datafile="C:\file path.txt" 

            dbms=dlm

            out=new data

            replace;

     delimiter='|';

     getnames=yes;

 guessinrows=100;

 

run;

 

Its working. 


Nice.

 

What you have now (probably without knowing it) is a working data step. proc import creates it, runs it, and writes it to the log. You can copy it from there and adapt it to your needs for fine-tuning.

ballardw
Super User

@librasantosh wrote:
Yes my data is in txt file and its not arranged in order. Is there any solution to create dataset without putting '.' for missing values in raw data. Data values are not arranged in neatly defined columns, but are separated by at least one space and contain some nonstandard characters, such as the dollar sign ($)

You need to be aware that this forum when pasting into the main message windows will often reformat text with removing blanks one of the most common elements. So post code and data into a code box using the {i} menu icon at the top of the message box to prevent that.

 

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

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 19 replies
  • 4339 views
  • 3 likes
  • 5 in conversation