BookmarkSubscribeRSS Feed
SRINIVAS_N
Calcite | Level 5
I want to read date value from Unix and the value I want to use in SAS programming.
5 REPLIES 5
AMSAS
SAS Super FREQ

Hi Srinivas_N

To fully answer this you need to supply more information:

Where is your data stored, what is the format of that data, etc.

For example if you were reading a text file "\some\file.txt" 

 

data mySASDS ;  /* This creates a SAS dataset in the WORK library */

  infile "\some\file.txt"  ; /* This defines your source file */

  input num_var str_var $ date_var ddmmyy. ; /* This tells SAS how to read the data in the source file */

run ;


There's more to it than that, but that's the basics. I suggest you go loop up those statements in the documentation and look at the examples

Reeza
Super User

What is the current reason you cannot do this?

What is the source data?

What have you tried that doesn't work?

 


@SRINIVAS_N wrote:
I want to read date value from Unix and the value I want to use in SAS programming.

 

SRINIVAS_N
Calcite | Level 5
Today() returns today's date
I want to pass a date value to control m scheduler ,so I want to get date
value from Unix to SAS
AMSAS
SAS Super FREQ

Hi, 
Really need more details of what you are attempting to do, as it is still unclear.
From this post it looks like you might be attempting to pass a parameter/argument from Unix into a SAS program

You can do this by using the SYSPARM invocation option, which the SAS program can then read via the SYSPARM macro variable, further details can be found here

Kurt_Bremser
Super User

If you want to import a typical UNIX timestamp into SAS, you need to do the following:

  • read into a numeric variable
  • add '01jan1970:00:00:00'dt to it
  • format as a datetime value or
  • use the datepart() function to extract the date, and use a date format

UNIX timestamps are counts of seconds like they are in SAS, but the zero point is different.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1675 views
  • 2 likes
  • 4 in conversation