Reading last non blank record from dat file

Reply
Occasional Contributor
Posts: 15

Reading last non blank record from dat file

Hi ,

 

i am trying to get last non blank record from an external file.

 

I tried with 

 

filename ocmd pipe "awk '/./{line=$0} END{print line}' /vfau/vfau_sit/sit05/datain/AppDirect/Landing/APPDIRECT_PROD_2018011105.dat"

 

and 


filename ocmd pipe "tac /vfau/vfau_sit/sit05/datain/AppDirect/Landing/APPDIRECT_PROD_2018011105.dat | egrep -m 1 ."

 

 

But our company has no Goptions accesible..and i am getting error like

 

ERROR 23-2: Invalid option name GOPTIONS.

25 ! GOPTIONS NOACCESSIBLE;
____________
23
ERROR: Error in the FILENAME statement.
ERROR 23-2: Invalid option name NOACCESSIBLE.

 

 

Is there any other approach?

Occasional Contributor
Posts: 15

Re: Reading last non blank record from dat file

Posted in reply to swathiprasad

It is like reading XXXXX from the below file.

 

ADJJSHJBSJJAJS

SJHDBSJSJJSJ

XXXXX

<Blankrecord>

<Blankrecord>

 

 

 

SAS Super FREQ
Posts: 825

Re: Reading last non blank record from dat file

Posted in reply to swathiprasad

All SAS statements end with a semicolon ";"

 

you are missing this

Occasional Contributor
Posts: 15

Re: Reading last non blank record from dat file

Posted in reply to swathiprasad
With semicolon only am getting the error as our company does not have access to goptions
SAS Super FREQ
Posts: 825

Re: Reading last non blank record from dat file

Posted in reply to swathiprasad
I guess you are running this with SAS Enteprise Guide as the front end.

Please post the complete log as attachment or as a code block (the {} symbol in the editor)
Super User
Super User
Posts: 9,599

Re: Reading last non blank record from dat file

Posted in reply to swathiprasad

Goptions has nothing to do with the code you are running - which is a command line command which you do need access for.  You can turn goptions off to get rid of this error:

https://communities.sas.com/t5/SAS-Enterprise-Guide/Turning-off-goptions-in-SAS-EG-code-node/td-p/13...

 

And docs:

http://support.sas.com/documentation/cdl/en/graphref/63022/HTML/default/viewer.htm#goptionschap.htm

 

However that will not solve your connection to the OS which may be turned off by default by your IT group - this is often the case.

Ask a Question
Discussion stats
  • 5 replies
  • 188 views
  • 0 likes
  • 3 in conversation