BookmarkSubscribeRSS Feed
random1
Fluorite | Level 6

I am making a mock data set. It doesn't like read in the dates.

Here is the first few lines with the first row:

data mockdata;

input LINK_I CARDNMBR DATE $ Date9. ACTIVE DELQs;

datalines;

1 1 30JUN2014 1 1

 

 

;

run;

 

In the output, it cuts off the last digit and gives 30JUN201  and it considers it a charater, not a date 😞

5 REPLIES 5
Reeza
Super User

What does the $ imply in the input statement? 

Remove it for starters. 

random1
Fluorite | Level 6

I thought you had to put that after a variable name to say its a character.

If I remove $  i.e. have:

 

data mockdata;

input LINK_I CARDNMBR DATE Date9. ACTIVE DELQs;

datalines;

1 1 30JUN2014 1 1

 

 

then the date value for first row is 19904. I don't want it to show as a number of days since 1960. I just want it to show as 30JUN2014.

If I remove "Date9." i.e. :

data mockdata;

input LINK_I CARDNMBR DATE ACTIVE DELQs;

datalines;

 

then the whole date column shows as missings (has ".")

Ksharp
Super User

data mockdata;

input LINK_I CARDNMBR DATE : Date9. ACTIVE DELQs;

format date date9.;

datalines;

1 1 30JUN2014 1 1

 

random1
Fluorite | Level 6

Thanks. This works.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 5 replies
  • 1125 views
  • 1 like
  • 4 in conversation