BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ab12nov
Obsidian | Level 7

Hi guys can you help me with the querry 

proc import datafile = 'C:\Documents and Settings\Administrator\Desktop\SAS\Excels_for_import\SASTopics_xls.xls'
out = SasTopic DBMS = excel;
range = "quick$";
run;

data SasUpdate;
set SasTopic;
Estimateddate = input(Date,date9.);
if Estimateddate < today() then
Status = 'Complete';
else 
Status = 'incomplete';
format Estimateddate date9.;
run;

The log window error : Invalid argument to function INPUT at line 164 column 17

The estimateddate variable is not getting formatted and today() function is returning date of 27SEP1997 not today's date.

Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Post a proc contents of your dataset after you import it, as well as your full log.

It's likely the date is being imported as a SAS data already. 

 


@ab12nov wrote:

Hi guys can you help me with the querry 

proc import datafile = 'C:\Documents and Settings\Administrator\Desktop\SAS\Excels_for_import\SASTopics_xls.xls'
out = SasTopic DBMS = excel;
range = "quick$";
run;

data SasUpdate;
set SasTopic;
Estimateddate = input(Date,date9.);
if Estimateddate < today() then
Status = 'Complete';
else 
Status = 'incomplete';
format Estimateddate date9.;
run;

The log window error : Invalid argument to function INPUT at line 164 column 17

The estimateddate variable is not getting formatted and today() function is returning date of 27SEP1997 not today's date.

Thanks in advance


 

View solution in original post

5 REPLIES 5
Kurt_Bremser
Super User

First of all, the today() function WILL return today's date, unless your computer's hardware clock is set to a wrong date.

Inspect your date column in the imported dataset. I am very sure that it will not contain a date in the SAS date9 format, so you have to find the correct informat for your values.

ab12nov
Obsidian | Level 7

I'm using VM.... but time there is set correctly... However the tab with internet time that was showing 25SEP2017.

 

I guess this is why SAS is unable to capture correct date. Thanks for heads up.

Reeza
Super User

Are you using a legitimate version of SAS. I've seen people use torrented versions which require setting back the date which would cause the issue you're seeing with date. 

There's a free version of SAS available for learning purposes. 

If you're using a legitimate version of SAS this comment does not apply :).

 

ab12nov
Obsidian | Level 7

Hi Reeza,

 

As you said, while seeing the date variable in content it was already formatted, so didn't have to format it.

 

Secondly, I'm quite sure the product is legit. My organisation has provided me the software. It is the system issue. So I'll have to reach out Tech guys. Although I ask about the version of SAS that is legit or not. Thanks for the update.

 

Cheers,

Ayushmaan

Reeza
Super User

Post a proc contents of your dataset after you import it, as well as your full log.

It's likely the date is being imported as a SAS data already. 

 


@ab12nov wrote:

Hi guys can you help me with the querry 

proc import datafile = 'C:\Documents and Settings\Administrator\Desktop\SAS\Excels_for_import\SASTopics_xls.xls'
out = SasTopic DBMS = excel;
range = "quick$";
run;

data SasUpdate;
set SasTopic;
Estimateddate = input(Date,date9.);
if Estimateddate < today() then
Status = 'Complete';
else 
Status = 'incomplete';
format Estimateddate date9.;
run;

The log window error : Invalid argument to function INPUT at line 164 column 17

The estimateddate variable is not getting formatted and today() function is returning date of 27SEP1997 not today's date.

Thanks in advance


 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 5 replies
  • 876 views
  • 0 likes
  • 3 in conversation