Help using Base SAS procedures

Update on certain field

Reply
Frequent Contributor
Posts: 75

Update on certain field

What I have in my table

file name second file name periodicity add_day

sts_selb_m.tsv       fich37.csv m           56

sts_setu_m.tsv       fich38.csv m           56

sts_trlb_m.tsv       fich39.csv m           56

ei_bpfa_q.tsv         fich40.csv q           57

ei_lmjv_q_r2.tsv      fich41.csv q           20

Q means Quarter , M means Month and add_day , the numbers of day to add.

What I want in term of table result:

file name         second filename      periodicity      add_day      dern_dispo

sts_selb_m.tsv      fich37.csv           m                56           31/05/2014

sts_setu_m.tsv      fich38.csv           m                56           31/05/2014

sts_trlb_m.tsv      fich39.csv           m                56           31/05/2014

ei_bpfa_q.tsv       fich40.csv           q                57           31/03/2014

ei_lmjv_q_r2.tsv    fich41.csv           q                20           30/06/2014

What I have in term of script

http://pastebin.com/XMffRBz6

What I want in term of script and ultimately my aim is to automate this script. But I'm not sure how to do that.

I was thinking of a for loop to go for each file name. The other part is the Q and the M. If there is a M, then use all the instructions for M. If it is a Q, use all the instructions for Q.

One thing as you must have see is I've encoded manually the add_day with 56 for the M and 20 for Q in this example. I would need to have it automated.

Should I use a macro or not?

Thanks.

PS: Do my explanations make sense?

Ask a Question
Discussion stats
  • 0 replies
  • 130 views
  • 0 likes
  • 1 in conversation