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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 19 replies
  • 2604 views
  • 4 likes
  • 4 in conversation