Prev: Prevalence and Bias Index
Next: Dynamic data set-Loop
From: Costas on 14 Dec 2009 12:38 Hi, I need to build a report about several cognos' cubes (dimensions, levels measures etc..) from .mdl files (ascii type) then contain the structure. First I import xxxx.mdl file and create variable x, than I exstract cube infos by scan(x, ....), because all infos are key-substring from first collumn. when I meet one key value I know the info is on the next double quoted substring. For example: data stat_cube; infile &infile truncover; input x $5000.; retain name datasource; length datasource $30.; if x NE ''; test=scan(x,1); select (test); when('Name') do; name=scan(x,2,'"'); valore=name; datasource=''; end; when('DataSource') do; datasource=scan(x,2,'"'); valore=datasource; end; when('OrgName') do; orgname=scan(x,2,'"'); valore=orgname; end; when('Dimension') do; dimension=scan(x,2,'"'); valore=dimension; end; when('Root') do; root=scan(x,2,'"'); valore=root; end; when('Levels') do; levels=scan(x,2,'"'); valore=levels; end; when('Measure') do; measure=scan(x,2,'"'); valore=measure; end; otherwise delete; end; if test='Name' then DataSource=''; run; Except for 'Measure', every info is on the row where I meet the key value and the uppuer program retrieve all I need. Sometime for 'Measure' infos are distribuited also on the next rows and, for some strange reason, cognos could brack it on the successive row. The sample below is from an mdl file: ******* original row data ******* .. .. <blank line> Measure 2687 "Margini" Storage Default OutPutScale 0 Decimals 0 ReverseSign False IsCurrency False IsFolder True DrillThrough False EndList <blank line> Measure 3041 "Var.% Mrg RC vs RP" Label "Var.% Mrg RC vs RP" ShortName "Var.% Mrg RC vs RP" Calc ( "MRG_RAC_RC(a)2143" - "MRG_RAC_RP(a)2973" ) / "MRG_RAC_RP(a)2973" Timing After_Rollup "ShortName"='Var.% Mrg RC vs RP' , "Calc"=( "MRG_RAC_RC(a)2143" - "MRG_RAC_RP(a)2973" ) / "MRG_RAC_RP(a)2973" and "MeasureInfo"="Margine costi / ricavi finanziari progressivo al mese corrente dell'ann" "o precedente." DrillThrough False <blank line> .. .. ******************************* For first bloc lines the program meet "Measure" and assign his value at valore=Margini. For the second I nedd estract also "ShortName" => valore2='Var.% Mrg RC vs RP' , "Calc" => valore3=( "MRG_RAC_RC(a)2143" - "MRG_RAC_RP(a)2973" ) / "MRG_RAC_RP(a)2973" and "MeasureInfo"="Margine costi / ricavi finanziari progressivo al mese corrente dell'anno precedente." As you can see on the second bloc info for "MeasureInfo" is splitted on 2 consecutive lines. I suppose for read the varius values for "Measure" I must use some do loop (do while(...)) that scan for all lines relative to the "Measure" bloc. Have you any tips about? Thank you in advance. Costas
From: Costas on 16 Dec 2009 06:52 no tips on how to read info from multiple rows? thanks. Costas
|
Pages: 1 Prev: Prevalence and Bias Index Next: Dynamic data set-Loop |