BookmarkSubscribeRSS Feed
andreas4
Calcite | Level 5

Hello!

 

What informat should i use to read the following data values as numeric variables form a csv?

 

"Sun, 22 Feb 2004"
input date:?????

Thanks in advance,

Andreas
2 REPLIES 2
PaigeMiller
Diamond | Level 26

First, remove the day of the week from the text string. Compress the blanks, and then the date9 informat should work.

 

data a;
    y='22 Feb 2004';
    x=input(compress(y),date9.);
    format x date9.;
run;
--
Paige Miller
ballardw
Super User

@andreas4 wrote:

Hello!

 

What informat should i use to read the following data values as numeric variables form a csv?

 

"Sun, 22 Feb 2004"
input date:?????

Thanks in advance,

Andreas

If that is the way the data is in the CSV you likely will need to read the value as character then so something like:

data example;
  x="Sun, 22 Feb 2004";
  y= input(scan(x,2,','),anydtdte16.);
  format y date9.;
run;

to create a date value.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 2 replies
  • 1051 views
  • 1 like
  • 3 in conversation