macros - How do I create this case statements in proc sql and append when tables are overwritten? -


i have spent several months data mining , creating technique find out information company. having trouble putting data appropriate , valuable presentation on how summarize information in sas. have 3 questions.

1)how in proc sql " if matched_by_t2 > b2_c2 add in new column "no bueno"

2)is there way have "(bc_c2/ original_count) %" how insert percent sign

3) if run query multiple times list of datasets how new tables named same "e_data_unmatched" append each time new table created , overwritten in imgur show 2 rows each timie program runs tables overwritten want ensure each time loop runs new records append table rather overwrite. 1 http://imgur.com/bzlefxy

thank you!

    proc sql; create table wanted select t1.occurences original_count       ,t2.occurences matched_by_t1       ,t3.occurences matched_by_t2       ,t2.occurences+t3.occurences b2_c2       ,t4.occurences not_matched       ,t5.occurences matched_by_t2 (select count(*) occurences query_for_reports1) t1     ,(select count(*) occurences query_for_reports1 edsys not null) t2     ,(select count(*) occurences e_data_unmatched ip not null) t3     ,(select count(*) occurences work.e_dat_unmatched ips= .) t4     ,(select count(*) occurences work.append_table13) t5 ; quit; 

1) add new column "no bueno" in sql set value based on conditiong " if matched_by_t2 > b2_c2"  2) concatenate percentage sign  proc sql; create table wanted select t1.occurences original_count       ,t2.occurences matched_by_t1       ,t3.occurences matched_by_t2       ,t2.occurences+t3.occurences b2_c2       ,t4.occurences not_matched       ,t5.occurences matched_by_t2, case when t3.occurences> t5.occurences 0  else 1 end no_bueno,  cast(((t2.occurences+t3.occurences)/ t1.occurences) nvarchar(5)) +'%' (select count(*) occurences query_for_reports1) t1     ,(select count(*) occurences query_for_reports1 edsys not null) t2     ,(select count(*) occurences e_data_unmatched ip not null) t3     ,(select count(*) occurences work.e_dat_unmatched ips= .) t4     ,(select count(*) occurences work.append_table13) t5 ; quit; 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -