- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to put some dates such as '01jan1999'd as column name, but I can't work it out, is it possible?
If yes I would like to rename adjacent columns from '01jan1999'd to '01jan2009'd, is it possible without writing alll the names?
alternatively I am thinking about putting the dates as records in a column and then doing a transpose,
but also here is there a fast method to put these names, like if it were a drag in excel?
thanks in advance
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
SAS enumerated variable lists can be incremented by 1 or -1 only as far as I know. You seem to want an arbitrary increment in this case MONTH. That's find but it does not work with enumerated variable lists.
If it were me I would keep the months/dates/ whatever as rows as long as possible. Then when you need to have the months/dates/whatever become variables transpose to variables and LABEL the variables in a way that communicates the details of the data that you have placed in the meta data. PROC TRANSPOSE statement IDLABEL will allow you to assign labels to the new variables using data.
Using a name prefix list you don't even have to know how many.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
First of all, why do you want them as columns at all? As you seem to already experienced yourself, it's not very convenient, neither for data manipulation programming nor reporting.
You say you can't work it. What have you tried? Showing som code might help.
You could achieve this by setting VALIDVARNAME = ANY, and use the name literal when specifying your column names.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I know that it's not convenient, but in this analysis is very helpful to know the exact month, e.g. 01march2002 instead of month47.
a trial would be like this, but it does not work
data base(rename=(month1-month180= '01jan1999'n to '01jan2009'n));set base;run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Seems easier to transpose your data, and the apply your date transformation on colmn values instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
SAS enumerated variable lists can be incremented by 1 or -1 only as far as I know. You seem to want an arbitrary increment in this case MONTH. That's find but it does not work with enumerated variable lists.
If it were me I would keep the months/dates/ whatever as rows as long as possible. Then when you need to have the months/dates/whatever become variables transpose to variables and LABEL the variables in a way that communicates the details of the data that you have placed in the meta data. PROC TRANSPOSE statement IDLABEL will allow you to assign labels to the new variables using data.
Using a name prefix list you don't even have to know how many.