BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Tom
Super User Tom
Super User

From that PHOTOGRAPH of your VIEWTABLE screen it looks you already have DATE variables. But that some of the values have the special missing value of .N and others have the special missing value of .C.

 

If you want to convert .C to some other date (why???) then a simple IF/THEN should do.

if dateendrole=.c then dateendrole='31DEC2099'd ;
Tom
Super User Tom
Super User

If the variable is numeric and displays as N or C then value is .n or .c.  SAS has 28 missing values.  The regular value is referenced in code as . (and normally prints as . also).  The others are referenced by period followed a letter or an underscore.  All of them are treated as missing so there should not be any need to convert .N into .

 

Why do you want to convert .C into some other value?

shawnchen0321
Obsidian | Level 7

Hello expert @Tom,

 

I need to identify the company announcement date that falls between the start and end dates of the director’s employment,

but the end date may display C and N at the same time (as shown in the previous picture).

 

In my dataset, it shows:

C = Current: C means that the director is still in office until now (which is informative). 

N = n/a: N means missing values ​​(which have no informational meaning).

 

If the program is used to allow missing, it may be inappropriate.

Thus, I think a more appropriate way is to turn C into a long time in the future and treat N as a missing processing method.

 

Thank you very much for your comment to make the program more perfect. Respect!

Patrick
Opal | Level 21

@shawnchen0321 Read through the answers already provided. The code for converting a special missing .C to a date in the future has already been shared here.

shawnchen0321
Obsidian | Level 7

Hello experts @Tom @Patrick @FreelanceReinh ,

 

I have solved the problem, and the program works successfully.

Thank you again.

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
  • 19 replies
  • 984 views
  • 4 likes
  • 4 in conversation