- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 03-31-2011 10:06 AM
(2539 views)
dataset1:
2001 $500 $400 200 300
2002 $600 $300 100 200
After transpose:
dataset2:
_name_ 2001 2002
acct1 $500 $600
acct2 $400 $300
acct3 200 100
acct4 300 200
as you can see from dataset2 two different data types asscociated to the year variables.
I would like to perform some calculations for instance: acct1 $600-$500=$100;
acct3 100-200 =100. is this possible, if yes, how to handle this situation?
Thanks,
2001 $500 $400 200 300
2002 $600 $300 100 200
After transpose:
dataset2:
_name_ 2001 2002
acct1 $500 $600
acct2 $400 $300
acct3 200 100
acct4 300 200
as you can see from dataset2 two different data types asscociated to the year variables.
I would like to perform some calculations for instance: acct1 $600-$500=$100;
acct3 100-200 =100. is this possible, if yes, how to handle this situation?
Thanks,
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi:
If you do a PROC CONTENTS on dataset2:
[pre]
proc contents data=dataset2;
run;
[/pre]
and then look at the list of variables, what is the type and format for the "year" variables???? SAS variable names cannot start with a number, they generally start with an underscore from transpose, such as _2001 and _2002. Can you paste the variable information to the forum???
cynthia
If you do a PROC CONTENTS on dataset2:
[pre]
proc contents data=dataset2;
run;
[/pre]
and then look at the list of variables, what is the type and format for the "year" variables???? SAS variable names cannot start with a number, they generally start with an underscore from transpose, such as _2001 and _2002. Can you paste the variable information to the forum???
cynthia
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
the variable name is _2001 _2002
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
and the PROC CONTENTS???
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
It is possible. $w.d is only the cloth of variable ,in sas it is numeric.
if you want different cloth for the same variable ,you can create another variable to contain the format then use function putn() or putc() to get it.
[pre]
_name_ 2001 2002 formate
acct1 $500 $600 dollar8.
acct2 $400 $300 dollar8.
acct3 200 100 8.
acct4 300 200 8.
[/pre]
Ksharp
if you want different cloth for the same variable ,you can create another variable to contain the format then use function putn() or putc() to get it.
[pre]
_name_ 2001 2002 formate
acct1 $500 $600 dollar8.
acct2 $400 $300 dollar8.
acct3 200 100 8.
acct4 300 200 8.
[/pre]
Ksharp