BookmarkSubscribeRSS Feed
PRAVIN_JAIN
Calcite | Level 5

I have a flat file to read in SAS with delimiter '¬'. Before reading in SAS, i want to check no of columns in each row using unix command however it gives incorrect result.

 

Command used - awk -F'¬' '{print NF}' in_file.txt | uniq

 

Please suggest.

1 REPLY 1
Patrick
Opal | Level 21

@PRAVIN_JAIN wrote:

I have a flat file to read in SAS with delimiter '¬'. Before reading in SAS, i want to check no of columns in each row using unix command however it gives incorrect result.

 

Command used - awk -F'¬' '{print NF}' in_file.txt | uniq

 

Please suggest.


For Unix/Linux these things are really simple to Google. There is so much out there. Like here for example.

 

WHY do you want to do this? If it's just so that some lines have less columns (like when there is no data for the last few columns) then just use the truncover option in the infile statement and SAS will handle this nicely. 

 

You could also use SAS for counting the characters. Just a SAS datastep with an infile and input statement and then the countc() function

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 1 reply
  • 345 views
  • 1 like
  • 2 in conversation