- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I need help trying to keep the variable admitDate formatted in the following code:
proc transpose data=temp
out=analysis
prefix=admitDate;
format admitDate yymmdd10.;
by patientId;
var age systolic procedure1 procedure2 procedure3 procedure4 procedure5 diagnosis1 diagnosis2 diagnosis3 diagnosis4 diagnosis5;
run;
**When I run it it gives the date as numbers. Is there a better way to do this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Well, the best way is not to put data as column names. Column names are there for your programming benefit, to ake your coding simpler and easier. Creating columsn with numbers/dates or anything else will just make your life harder. Prefix option is there give you a constant prefeix for all the data in the array, so you can refer to things via shorthand:
procedure:
You can't use that if the prefix changes each time. That is one simple example, but there are many other reason why not to do it.
Now variable label is a different matter - that is not used in programming, it is purely for display. That can be anything you like. You can set a label by:
proc transpose data=temp out=analysis; format admitDate yymmdd10.; by patientId; var age systolic procedure1 procedure2 procedure3 procedure4 procedure5 diagnosis1 diagnosis2 diagnosis3 diagnosis4 diagnosis5; idlabel admitdate; id admitdate; run;
Note, I haven't tested if that is valid syntax as you have not provided any test data (form of datastep) or required output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I tried it. Its not exactly what I am looking for. I don't need the dates as row headers. I would like an array like how mentioned in my initial code which is how I need the data organized. I just need each admit date to format as a date and not as Number. How can I do that using the prefix statement as an array to separate the admit dates in the code below:
proc transpose data=temp
out=analysis
prefix=admitDate;
format admitDate yymmdd10.;
by patientId;
var age systolic procedure1 procedure2 procedure3 procedure4 procedure5 diagnosis1 diagnosis2 diagnosis3 diagnosis4 diagnosis5;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Then please show what you do require. Provide test data in the form of a datastep, and what the output should look like.