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: 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
  • 5 replies
  • 1641 views
  • 2 likes
  • 4 in conversation