BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Nasser_DRMCP
Lapis Lazuli | Level 10

Hello,

 

I have 3 key figures and I would like to print with a specifiq format.

each figure has an old label (measure_label_from)  and a new label (measure_label_to).

what I try to do is to translate the label of the figure by using a format.

It works for 2nd and the 3rd figure but NOT for the first. I don't know why.

thanks in adance for your help

Nasser

 
Data T_indicateurs ;
infile datalines dsd;
input figures ~ $50. amount ;
datalines ;
'Mont DDT sans cumul M0'   , 9999
'Mont LRA sans cumul M0'   , 1234
'Taux DDT ECR sans cumul M0'  , 0.65
run ;

Data T_indicateurs ;
Set T_indicateurs ;
figures = compress(figures,"'") ;
Run ;


Data T_indic_transco ;
infile datalines dsd;
input measure_label_from ~ $50. measure_label_to ~ $50. ;
datalines ;
'Mont DDT sans cumul M0'   , 'ENTREE MENS DDT&SU'
'Mont LRA sans cumul M0'   , 'ENTREE MENS EN RA'
'Taux DDT ECR sans cumul M0'  , 'TX DE SORTIE DDT&SU / Encours'
run ;

Data T_indic_transco_format (Drop = measure_label_from measure_label_to) ; 
Set T_indic_transco ;
Retain FMTNAME '$f_measure_label' ;
START = Compress(measure_label_from,"'") ;
LABEL = Compress(measure_label_to,"'") ; 
Run ;

Proc format CNTLIN =  T_indic_transco_format ; run;

proc print data=T_indicateurs ; 
format figures $f_measure_label. ;
run ;

please, run this code and you will notice that only the first row is not translated

 

 

1 ACCEPTED SOLUTION
7 REPLIES 7
Kurt_Bremser
Super User

Running your code gives me this result:

Beob.    figures                           amount

  1      ENTREE MENS DDT&SU               9999.00
  2      ENTREE MENS EN RA                1234.00
  3      TX DE SORTIE DDT&SU / Encours       0.65

Looks fine to me, all "figures" values were re-formatted.

Nasser_DRMCP
Lapis Lazuli | Level 10

Thanks Kurt. for me It doesn't work. running the code gives me this result.

Capture.PNG

Nasser_DRMCP
Lapis Lazuli | Level 10

I have copy/paste the code from my original post into sas and then it works now.

thanks a  lot Kurt !!! 

Nasser_DRMCP
Lapis Lazuli | Level 10

Yes Kurt,

  

I noticed that in the step "datalines" I put some tabulation between values and I noticed that it does NOT work for each lines (transco) that hold a TABULATE and it works for all lines without tabulate.

so by replacing all tabulations by just space, every lines work !!!


thanks kurt !

Kurt_Bremser
Super User

I have my EG enhanced editor set to always replace all tabs (entered or read from file) with spaces. This also does away with problems caused by different tab spacings (ie 2 in EG, but 8 on UNIX).

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 793 views
  • 1 like
  • 2 in conversation