BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

You are trying to read all of the records from one CSV file by using a DO loop during one iteration of the DATA step.

But inside the DO loop you have coded subsetting IF statements that will cause the whole DATA step to re-start.

So once any of those subsetting IF statements are false you will stop processing the current CSV file and move onto the next one.

Aman4SAS
Obsidian | Level 7

Hi TOM,

Thanks for your input.

But as mentioned above in that case it must read atleast one observation.

but its showing zero observation it seems its not getting inside of csv files.

Thanks

jakarman
Barite | Level 11

Aman4SAS,  Tom is right
Showing the number of obs Observations is telling something on the output dataset.
When there is nothing to output it will tell you 0....    That doesn't say you anything on what has been readed/processed.

The best approach for debugging is eliminating parts of the code (eg %codelist) and see what is happening.

 

An other remark: There is no need for that step creating a dirlist, you could define the wildcarding immediate at the filepath statement

---->-- ja karman --<-----
Aman4SAS
Obsidian | Level 7

Hi Jaap,

I heartily agree that Tom Sir is right.

"those subsetting IF statements are false you will stop processing the current CSV file and move onto the next one"

at the time moving to next , it must left something behind.

what i can see, its reading all desired observation but its not putting on Created dataset.

The same program is running very fine for for txt files but its not working in my csv files. so i m confuse to remove my subset conditions,

As per using wildcard. Thanks for your valuable input. I have used that to resolved my problem for temp basis. and it works

Thanks

jakarman
Barite | Level 11

Aman4SAS,  There was a time computer-resources where that expensive you did a lot of desktopwork (paper pencil) preventing mistakes as much as possible. The hollerith cards very patient doing some coding with that. At his era your time is much more valuable than the one of the machine. As long as your causing more trouble (losing data, changing/sending data) a try to verify some assumption is more effective.

Put a * (comment or remove) that %codelist (drop that card). Same for the other If _error_  if soc.

See what happen, will cost less than a few minutes. 

When assumption is right you see obs>0 when still 0 there is something different.

As you say with txt-files it is working but with csv not. For me a csv-file is just a special text file where a special chosen character has the meaning of column delimiter.
You are possible confused with those suffixes of files, being believed having a special meaning. Do not be that easy in your believe.
Just at Windows this done with associations to find an associate program. It makes live easy that way. At Unix and Mainframe they are also existing but associations? no way.
You are liking probably zip-files. For fun docx xlsx egp pkg and much more are zip-files with a dedicated content for some programs             

---->-- ja karman --<-----

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!

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
  • 19 replies
  • 2267 views
  • 6 likes
  • 7 in conversation