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

Hello SAS Supoort Communities,

I would like to convert the additional_signature_date_1 variable in the attached SAS dataset from a character variable to a numeric variable (a numeric SAS date).  I used the following code:
data audit.a2011p1;
set audit.a2011p;
date_var = input(additional_signature_date_1,date9.);
format date_var date9.;
run;
 
After running this, the date_var variable has a missing value (a dot) for each observation.  What should I change in my code?
 
God bless, best regards, and thanks so much,
Jadallah
1 ACCEPTED SOLUTION

Accepted Solutions
ShiroAmada
Lapis Lazuli | Level 10

Looking at obs=14 for the variable additional_signature_date_1='8/25/2011' - This is NOT date9. informat but mmddyy10 informat.  

 

Try this....

data audit.a2011p1;
set audit.a2011p;
date_var = input(additional_signature_date_1,mmddyy10.);
format date_var date9.;
run;

Always check your log, WARNING messages must be there or _ERROR_.

 

Hope this helps.

View solution in original post

4 REPLIES 4
ShiroAmada
Lapis Lazuli | Level 10

Looking at obs=14 for the variable additional_signature_date_1='8/25/2011' - This is NOT date9. informat but mmddyy10 informat.  

 

Try this....

data audit.a2011p1;
set audit.a2011p;
date_var = input(additional_signature_date_1,mmddyy10.);
format date_var date9.;
run;

Always check your log, WARNING messages must be there or _ERROR_.

 

Hope this helps.

jjadall1
Quartz | Level 8

God bless you and your family!  Thank you so much!  I appreciate it!  It worked!

ShiroAmada
Lapis Lazuli | Level 10

Amen PTLA (Praise The Lord Almighty).

 

You have a blessed day and coming weekend  jjadall1

Tom
Super User Tom
Super User

I am not going to download a zip file. Can you post some of the values of the charcter variable? Make sure to check whether the values have leading spaces.  For example you could run this data step to print the first 10 non-missing values.

data _null_;
  set audit.a2011p;
  where not missing(additional_signature_date_1);
  put additional_signature_date_1 $quote. ;
  if _n_ >= 10 then stop;
run;

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