LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2011, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Sat, 24 Sep 2011 16:11:45 -0400
Reply-To:     Mahesh <peesari.mahesh@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Mahesh <peesari.mahesh@GMAIL.COM>
Subject:      Build pyramid with sas code

HI all,

I have a below values in data set and how can i build pyramid? * ** *** **** *****

i want to move first row to start at position 5 and later on decreasing as moving to next record. My output should be this way.

* * * * * * * * * * * * * * * * * * * * *

please help out.

I was successful for passing dynamic values which will generate tables with star values for x no of rows,but i am unable to arrange in proper way to build a pyramid.

Please check below code:

data re; x ='*'; /*pass any value at array*/ array m(10) $; do i = 1 to 10; if m(i) = m(i) then do ; m(i) = x; output; end; end; drop i b x; run; /*make var statement in transpose equal to no variables*/ proc transpose data=re out=rtrt; var m1 - m10; run; data rtrt1; set rtrt; /*try to conctenate without writing all thecolumn names*/ xd = compress(col1 || col2 || col3 || col4 || col5 || col6 || col7 ||col8 || col9 ||col10); t = _n_; drop col1 -col10 ; run; proc sort data = rtrt1 out=v(drop=t _name_); by descending t; run; proc print; run; proc sql; select distinct(xd) into : x1 - :x10 from v; quit;

DATA _NULL_; set v; PUT xd; run;

Thanks, Mahesh P


Back to: Top of message | Previous page | Main SAS-L page