- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Below is my Proc Transpose logic however some of the records in my output is showing blank. How can I remove the blank and have the output show on the same row?
Proc transpose data=Acct_Prod
out=Accts3 ( drop=_NAME_ _LABEL_);
by accno bsb Branch Openmth L3;
id month;
var accbal;
run;
Output as per below:
AccNo | bsb | Branch | OpenMth | L3 | June | July | August |
123456 | 123 | DW | 31-Aug-18 | S | 5000.23 | ||
123456 | 123 | DW | 31-Aug-18 | S | . | 5000.23 | 5000.23 |
Appreciate your help.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
have you tried to set prefix=month
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Can you illustrate this?
"How can I remove the blank and have the output show on the same row?"
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I would want my result to be like the following. That's what I mean by removing the blank.
AccNo | bsb | Branch | OpenMth | L3 | June | July | August |
123456 | 123 | DW | 31-Aug-18 | S | 5000.23 | 5000.23 | 5000.23 |
Thanks kindly
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Perhaps a data model crux. A temporary solution could be another pass of the transposed dataset and update:
data have;
input (AccNo bsb Branch OpenMth L3 June July August) ($) ;
cards;
123456 123 DW 31-Aug-18 S 5000.23 . .
123456 123 DW 31-Aug-18 S . 5000.23 5000.23
;
data want;
update have(obs=0) have;
by accno bsb branch ;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Reeza,
I've test the by variables and one of them was different for some reason.
Thanks for that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
This can also happen when the ID variable is also in the BY statement and can be useful if you want to create a diagonal matrix.
proc transpose data=sashelp.class out=agematrix;
by name;
id name;
var age;
run;