Recently in the SAS Community Library: Creating snappy and eye-catching email headers for marketing campaigns can often be difficult. SAS' @ADAMPOLLACCHI introduces you to a new feature available in SAS Customer Intelligence 360: Gen AI email headers.
Hi guys,
I have a quite trivial problem. I have a number which can have one decimal point and I want to "trunc it down" by 0.5 step. It means: if I have 2.2 I want 2. If I have 2.4 I want 2. If I have 2.6 I want 2.5, like shown in the following code:
data numbers;
input have $3. want $5.;
datalines;
2.2 2
2.6 2.5
2.9 2.5
3.1 3
;
run;
Can anyone help me please? 🙂
Thanks in advance! Filip
... View more
Hello
Lets say I have a data set with many rows and many columns and I want to select the rows of one specific customer.
What is the most quick way to do it between these 4 ways or maybe there is a better way?
Data Way1;
set r_r.t100millionrows(Where=(CustID=123456));
Run;
proc sql;
create table Way2 as
select *
from r_r.t100millionrows
where lakoach=7550
;
quit;
proc sql;
create table Way3 as
select *
from r_r.t100millionrows(Where=(lakoach=7550))
;
quit;
proc sql;
create table Way4(Where=(lakoach=7550)) as
select *
from r_r.t100millionrows
;
quit;
... View more
I have an excel spreadsheet template that has to be filled in every week with SAS data. Way back when, I used DDE to do this and place data in pre-defined cells in the excel template. Since DDE is gone to pasture, I'd like to be able to do this with ODS excel if that is possible. Anyone have an idea of how I would start. I use ODS Excel all the time to create fresh excel tables but never for a pre-defined excel spreadsheet template. Help.
... View more
I am trying to rename the Break after Region to say Total instead of Region 11 repeated. I have tried using compute after but since I did that to rename the rbreak, it is not allowing me to use that twice. I have also tried to code within the same compute block, but it is not renaming the Region breaks to Total. Any suggestions?
Proc Report Code
options missing=0;
proc report data=work.syp1113 nowd;
where year=2024;
column region county month Total;
define region / group 'Region' width=15 format=$regionfmt. order=data;
define county / group 'County' width=20 format=$cntyfmt.;
define month / across 'Month' width=20 format=monthfmt. order=internal;
define Total/computed;
compute Total;
Total=sum(_c2_, _c3_ ,_c4_, _c5_,_c6_,_c7_,_c8_,_c9_,_c10_,_c11_,_c12_,_c13_);
endcomp;
break after Region /summarize style=[font_weight=bold];
rbreak after /summarize style=[font_weight=bold background=lightgrey];
compute after;
region='State';
endcomp;
run;
Current Output
I would like the second Region 11 to be named Total instead of repeating the Region name.
... View more
I am unable to find the logic behind this.
How to find the begining and the end of the year when the week start on Saturday and end on Friday.
Does someone understand the logic of that.
/* Therefore, if the fist January 2025 is Weneday then the begining of the year will be Saturday 28, 2024 */
data demo;
format date weekdatx. sat_start_of_week sat_end_of_week sat_start_of_year sat_end_of_year year_beg_date year_end_date date9.;
do date='28dec2013'd to '02jan2026'd;
sat_start_of_week=intnx('week.7',date,0,'b');
sat_end_of_week=intnx('week.7',date,0,'e');
year_beg_date=intnx('year',intnx('week.7',date,0,'b'),0,'beg');
year_end_date=intnx('year',intnx('week.7',date,0,'b'),0,'end');
/* sat_start_of_year=intnx('year', sat_start_of_week, 0, 'b');*/
/* sat_end_of_year=intnx('year', sat_start_of_week, 0, 'e');*/
output;
end;
run;
proc print data=demo;
run;
/*create dataset*/
data original_data;
format year_start_date year_end_date date9.;
input year_start_date :date9. year_end_date :date9.;
datalines;
28Dec2013 02Jan2015
03Jan2015 01Jan2016
02Jan2016 30Dec2016
31Dec2016 29Dec2017
30Dec2017 28Dec2018
29Dec2018 27Dec2019
28Dec2019 01Jan2021
02Jan2021 31Dec2021
01Jan2022 30Dec2022
31Dec2022 29Dec2023
30Dec2023 27Dec2024
28Dec2024 02Jan2026
;
run;
/*view dataset*/
proc print data=original_data;
... View more
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
The SAS Customer Recognition Awards are open for nominations until Jan 31. Winners get a full trip to SAS Innovate (May 6-9) in Orlando, FL! See the contest description for rules and how to apply.