Benjy Tracker
https://communities.sas.com/kntur85557/tracker
Benjy TrackerSat, 12 Oct 2024 09:28:39 GMT2024-10-12T09:28:39ZRe: Leading Blanks
https://communities.sas.com/t5/SAS-Programming/Leading-Blanks/m-p/51211#M10724
One way of looking at the problem is that you're not losing the blanks, you are just left aligning your character variable. So right align it and add blanks. The RIGHT function will right-align the variable when output.Fri, 15 Apr 2011 18:05:28 GMThttps://communities.sas.com/t5/SAS-Programming/Leading-Blanks/m-p/51211#M10724Benjy2011-04-15T18:05:28ZRe: Multiple values for a "variable"
https://communities.sas.com/t5/SAS-Programming/Multiple-values-for-a-quot-variable-quot/m-p/51365#M10733
It sounds to me like you want to build yourself a multi-dimensional array -- perhaps something like the following:<BR />
dimension 1=inning<BR />
dimension 2=at bat (seq number of at-bat in the inning) <BR />
dimension 3=batter<BR />
dimension 4=multimensional array of defensive players involved in play<BR />
dimension 5=result<BR />
<BR />
That's off the top of my head. But the problem sounds as if it is soluble by building arrays. Or hash tables instead of arrays.Fri, 15 Apr 2011 17:46:23 GMThttps://communities.sas.com/t5/SAS-Programming/Multiple-values-for-a-quot-variable-quot/m-p/51365#M10733Benjy2011-04-15T17:46:23ZRe: Calculation number of different observations
https://communities.sas.com/t5/SAS-Procedures/Calculation-number-of-different-observations/m-p/41420#M10702
I suggest using the retain statement.<BR />
DATA;<BR />
RETAIN N ; /* N is set to missing and will be retained in each subsequent iteration */<BR />
IF _N_=1 THEN N=0 ; /*first case N=0. All other cases N is still missing */<BR />
N=SUM(N, +1) ; /*FOR FIRST CASE N=0+1. The value of 1 is carried over to the second case and then 1 is added to it so the second case becomes 2. For the third case the value of 2 is retained, i.e. carries over, and 1 is added to this so N for the 3rd case is 3. And so on.*/<BR />
/* Using N=N+1 would work here as well as N=SUM(N, 1) but the latter form is good practice because it insures that a missing value for N will not make the result of the addition null or missing.*/Thu, 31 Mar 2011 13:33:42 GMThttps://communities.sas.com/t5/SAS-Procedures/Calculation-number-of-different-observations/m-p/41420#M10702Benjy2011-03-31T13:33:42Z