BookmarkSubscribeRSS Feed
johnhuang12
Calcite | Level 5

I have this data

Input

School NameStateSchool Code 26/07/2009 02/08/2009 09/08/2009 16/08/2009
Northwest HighIL1455606060606
Georgia HighGA14705050506
Macy HghTX45456NANANANA

The desired output is

School NameState School Code DateAbsent
Northwest HighIL14566 26/07/20096
Northwest HighIL14556 02/08/20096
Northwest HighIL14556 09/08/20096
Northwest HighIL14556 16/08/20096
Georgia HighGA147 26/07/20095
Georgia HighGA147 02/08/20095
Georgia HighGA147 09/08/20095
Georgia HighGA147 16/08/20096
Macy HghTX45456 26/07/2009NA
Macy HghTX45456 02/08/2009NA
Macy HghTX45456 09/08/2009NA
Macy HghTX45456 16/08/2009NA

This is the code I have written

proc sort data-work.input;

by School_Name State School_Code;

run;

proc transpose data=work.input out=work.inputModified;

by by School_Name State School_Code;

run

But I don't get the desired output the dates are actual variables when imported into sas the become _26_07_2009. Note there are about 185 dates and they are actual variables.

Pls Help

1 REPLY 1
data_null__
Jade | Level 19

The variable _NAME_ will have the variable name and if your variables have labels _LABEL_ will have the the value of that label.  You can read _NAME_ using the INPUT function to create DATE.  _LABEL_ might contain a version of date that does not need to be translated.

17         data _null_;
18            _name_ = '_26_07_2009';
19            date = input(translate(_name_,' ','_'),ddmmyy11.);
20            format date date9.;
21            put _all_;
22            run;

_name_=_26_07_2009 date=
26JUL2009 _ERROR_=0 _N_=1

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
  • 1 reply
  • 656 views
  • 0 likes
  • 2 in conversation