BookmarkSubscribeRSS Feed
Badjuju
Fluorite | Level 6

Hello. Have dataset with colum of dates; column labeled "action_date" and has type "Date" and length 8 with format "MMDDYY10."

Dates look like this when I print the dataset:  11/28/2016

 

When I run this code, I expect to get a number. I'm actually getting nothing; the entire column is populated with periods. In the log, I do have a bunch of identical notes: "Invalid argument to function INPUT at line 28 column 12."

 

data work.fy17_usa_p_test;
set work.fy17_usa_p;
new_date = input(action_date, mmddyy10.);
run;

 

At the end of the day, I'm just trying to change the date format from 11/28/2016 to 2016-11-28. 

I think I'll go with something like 

 

data work.fy17_usa_p_test;
set work.fy17_usa_p;
new_date = input(action_date, mmddyy10.);
format new_date yymmdd10.;
drop action_date;
rename new_date = action_date;
run;

 

but before getting there I need to get the input(action_date, mmddyy10.) to work.

 

Thanks in advance.

 

P.S.: Here's a sample of the log:

 

NOTE: Invalid argument to function INPUT at line 28 column 12.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be printed.
assistance_award_unique_key=ASST_NON_17E5624332740002_7300 award_id_fain=17E5624332740002 award_id_uri=
federal_action_obligation=20000 non_federal_funding_amount=5000 total_funding_amount=25000 face_value_of_loan=0
original_subsidy_cost=. total_subsidy_cost=0 total_loan_value=-25000 action_date=12/20/2016 action_date_fiscal_year=2017
period_perform_start=12/01/2016 awarding_agency_code=73 awarding_agency_name=SMALL BUSINESS ADMINISTRATION (SBA)
awarding_sub_agency_code=7300 awarding_sub_agency_name=SMALL BUSINESS ADMINISTRATION awarding_office_code=733510
awarding_office_name=  funding_agency_code=73 funding_agency_name=SMALL BUSINESS ADMINISTRATION (7300) funding_sub_agency_code=7300
funding_sub_agency_name=SMALL BUSINESS ADMINISTRATION funding_office_code=733510 funding_office_name=  recipient_duns=
recipient_name=KGS CONSTRUCTION SERVICES, INC. recipient_parent_name=  recipient_parent_duns=  recipient_country_code=USA
recipient_country_name=UNITED STATES recipient_address_line_1=10363 PIPER LN recipient_address_line_2=  recipient_city_name=MANASSAS
recipient_county_code=683 recipient_county_name=MANASSAS CITY recipient_state_code=VA recipient_state_name=VIRGINIA
recipient_zip_code=20110 recipient_zip_last_4_code=2053 recipient_foreign_city_name=  recipient_foreign_province_name=
recipient_foreign_postal_code=  cfda_number=59.016 cfda_title=SURETY BOND GUARANTEES assistance_type_code=11
assistance_type_description=  award_description=PARKING GARAGE REPAIRS business_funds_indicator_code=NON bus_funds_indicator_desc=
business_types_code=23 business_types_description=  correction_delete_indicator_code=  correction_delete_indicator_desc=
action_type_code=A action_type_description=  record_type_code=2 record_type_description=  recipient_city_code=  new_date=. _ERROR_=1
_N_=20
NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to
      missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      151235 at 28:12  

2 REPLIES 2
SASKiwi
PROC Star

You only use the INPUT function if the data variable you are trying to convert is character. In your case it is numeric and already a SAS date. If you want to assign your date to a new date variable this will do it:

new_date = action_date;
ed_sas_member
Meteorite | Level 14

Hi @Badjuju 

@As action_date is already a SAS date, there is no need to use the input function and create a new variable to then delete the first one.

I think you can simply apply the new format to action_date:

data work.fy17_usa_p_test;
set work.fy17_usa_p;
format action_date yymmdd10.;
run;

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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