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 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!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 786 views
  • 0 likes
  • 2 in conversation