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.

 

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!

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.

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