Hello, I have to create a dataset that shows an individual line for every combination of ID-variables (the character variables in the example below) even if there is a zero value for this record. This is it is, my problem is a bit like filling in missing observations using proc timeseries - but without time variables; searched the community for a while, but I always found something linked to timeseries. My actual data set "have" is large, which is why I would like to optimize the following code. I mistrust the point statements I am using. My question is, could it be faster? Data Have; Input HPG $ Plant $ Material $ X; Datalines; FA 0004 200 4 FB 0004 209 5 MGG 0001 201 6 MGU 0001 203 8 MGG 0002 203 8 MGG 0004 210 1 ; Proc SQL NoPrint; Select Count(Distinct HPG) As N_HPG, Count(Distinct Plant) As N_Plant, Count (Distinct Material) As N_Material Into :N_HPG, :N_Plant, :N_Material From A; Create Table HPG As Select Distinct HPG From A; Create Table Plant As Select Distinct Plant From A; Create Table Material As Select Distinct Material From A; Quit; %Put **&N_HPG.**&N_Plant.**&N_Material.**; Data Want (Drop=rc); Declare Hash H (); H.Definekey('HPG','Plant','Material'); H.Definedata('X'); H.Definedone(); Do Until (Eof_H); Set Have End=Eof_H; H.Add(); End; * critical part, beginning - I think; Do i=1 To &N_HPG.; Set HPG Point=i; Do j=1 To &N_Plant.; Set Plant Point=j; Do k=1 To &N_Material.; Set Material Point=k; rc=H.Find(); If rc ne 0 Then X=0; Output; End; End; End; * critical part, end; Stop; Run; Thanks&kind regards
... View more