12-06-2019
dscamelo
Obsidian | Level 7
Member since
12-12-2017
- 14 Posts
- 13 Likes Given
- 0 Solutions
- 0 Likes Received
-
Latest posts by dscamelo
Subject Views Posted 3987 12-06-2019 11:32 AM 726 02-14-2019 06:47 AM 4875 02-14-2019 06:18 AM 4882 02-14-2019 06:01 AM 4953 02-13-2019 02:57 PM 5004 02-13-2019 01:37 PM 3599 01-30-2018 04:25 AM 3677 01-29-2018 01:08 PM 5675 12-15-2017 10:25 AM 5685 12-15-2017 10:09 AM -
Activity Feed for dscamelo
- Posted Multiple reports into email HTML body. on ODS and Base Reporting. 12-06-2019 11:32 AM
- Liked Re: Custom Date Format for Reeza. 02-14-2019 06:48 AM
- Liked Re: Custom Date Format for ballardw. 02-14-2019 06:48 AM
- Posted Re: Custom Date Format on SAS Programming. 02-14-2019 06:47 AM
- Liked Re: Custom Date Format for ChrisNZ. 02-14-2019 06:19 AM
- Liked Re: Custom Date Format for ChrisNZ. 02-14-2019 06:19 AM
- Posted Re: Custom Date Format on SAS Programming. 02-14-2019 06:18 AM
- Liked Re: Custom Date Format for novinosrin. 02-14-2019 06:18 AM
- Liked Re: Custom Date Format for Tom. 02-14-2019 06:04 AM
- Posted Re: Custom Date Format on SAS Programming. 02-14-2019 06:01 AM
- Liked Re: Custom Date Format for novinosrin. 02-13-2019 02:58 PM
- Posted Re: Custom Date Format on SAS Programming. 02-13-2019 02:57 PM
- Liked Re: Custom Date Format for novinosrin. 02-13-2019 02:36 PM
- Posted Custom Date Format on SAS Programming. 02-13-2019 01:37 PM
- Posted Re: Connecting to Two Remote Servers on SAS Enterprise Guide. 01-30-2018 04:25 AM
- Liked Re: Connecting to Two Remote Servers for nhvdwalt. 01-30-2018 04:23 AM
- Liked Re: Connecting to Two Remote Servers for SASKiwi. 01-29-2018 03:46 PM
- Posted Connecting to Two Remote Servers on SAS Enterprise Guide. 01-29-2018 01:08 PM
- Posted Re: How to define optional parameters in a function? on SAS Procedures. 12-15-2017 10:25 AM
- Posted Re: How to define optional parameters in a function? on SAS Procedures. 12-15-2017 10:09 AM
-
Posts I Liked
Subject Likes Author Latest Post 2 1 2 3 1
12-06-2019
11:32 AM
Hi everyone, I need some help; I need to write a code that will send an email and I need it to have some tables. Using PROC REPORT works well enought when it's a single one, but when I add the second, a page break is inserted that ends up messing the layout. ODS _ALL_ CLOSE;
OPTIONS EMAILSYS=smtp;
OPTIONS EMAILAUTHPROTOCOL=none;
OPTIONS EMAILHOST="smtp.mail.com";
OPTIONS EMAILPORT=25;
FILENAME myemail EMAIL
TO = ("recipient@mail.com")
FROM = ("sender@mail.com")
TYPE = 'text/html'
SUBJECT = "Reports";
ODS HTML BODY=myemail STYLE=EGDefault;
/* Email text */
ODS HTML TEXT = '<p>Greetings,</p>';
ODS HTML TEXT = '<p>Here are the results on this week.</p>';
ODS HTML TEXT = '<p style="font-size:16px; font-style: italic">Report 1</p>';
/* First Report */
PROC REPORT DATA=sashelp.class;
RUN;
/* Back to the email */
ODS HTML TEXT = '<span>Some more text.</span>';
ODS HTML TEXT = '<p style="font-size:16px; font-style: italic">Report 2</p>';
/* Second Report */
PROC REPORT DATA=sashelp.class;
RUN; /* Finishing the email */
ODS HTML TEXT = 'That is all, best regards';
ODS _ALL_ CLOSE; Has anyone had this problem and found a solution? Thanks in advance!
... View more
02-14-2019
06:47 AM
That worked! Thank you, @ChrisNZ ! And thanks again to everyone who tried to help, especially @novinosrin!
... View more
02-14-2019
06:18 AM
Sure, @novinosrin, My code is something like this... /* This would be any date I need to separate data from */
%LET date_routine = %SYSFUNC(MDY(1,1,1992));
%LET semester_begin = %SYSFUNC(INTNX(semiyear,&date_routine.,0,b));
%LET semester_end = %SYSFUNC(INTNX(semiyear,&date_routine.,0,e));
/* This is the what I need, a way to quickly format the date by semester, without casting a sequence of strings*/
%LET formatted = %SYSFUNC(PUTN(&semester_begin.,yymmn6.));
PROC SQL;
CREATE TABLE RETAIL_&formatted. AS
SELECT
*
FROM
sashelp.retail AS r
WHERE
r.date BETWEEN &semester_begin. AND &semester_end.;
QUIT; Obviously, the "formatted" variable would be outputted to year and month, instead of year and semester. What I would need is something like the format YYMMn6, but instead a YY"SS"n6. What I need should have been fairly simple, except that format doesn't exist. So I was trying to create it myself, but needed help. Have I made it clearer? Thanks again for trying to help.
... View more
02-14-2019
06:01 AM
@Reeza, the one that has 3 was a quarter. The word semester means "six months", and that is what I am going for.
... View more
02-13-2019
02:57 PM
Hi, @novinosrin, thanks for the quick reply. I'm a bit confused, but that doesn't seem like it would work for any date, only for 2018. The idea would be to output my data to various tabels e.g. ORDERS_201701, PAYMENTS_201701, SALES_201702 , PAYMENTS_201702, ... , SALES_201901, PAYMENTS_201902. My idea would be something like: the routine just got called, then the dates that I'm currently processing would be &have. in the following example. %LET dt_begin_sem = %SYSFUNC(INTNX(semiyear,&have.,0,b));
%LET dt_end_sem = %SYSFUNC(INTNX(semiyear,&have.,0,e));
Then, whenever a row had its date between the beginning and end of semester, it would be included in the table being currently generated. So table ORDERS_201701 would have everything from 01JAN2017 to 30JUN2017. Another option would be a function that outputted semesters, but I haven't found anything like that.... Comparing the desired function "SMTR" to the existing function "QTR", it would be something like: QTR(15JAN2017) = 1
QTR(20SEP2017) = 3
SMTR(15JAN2017) = 1
SMTR(20SEP2017) = 2 I hope I managed to make myself clear, english is not my first language. Thanks again.
... View more
02-13-2019
01:37 PM
Hi, everyone. I have a routine that separates data based on its semester. I need some help creating a custom date format that would output a date in the format YYYYSS (Y = Year, S = Semester), like this: +-----------+---------+
| DATE | OUTPUT |
+-----------+---------+
| 05FEB2018 | 201801 |
| 05AUG2018 | 201802 | | 13JAN2019 | 201901 |
+-----------+---------+ Can anyone help me? Thanks in advance.
... View more
01-30-2018
04:25 AM
Thank you both for your replies, @SASKiwi, @nhvdwalt. I'll go ahead and check if SAS/Connect is an option here. If it is, where do I get the basics on how to use it? If not, I'll think of a workaround. Thanks again.
... View more
01-29-2018
01:08 PM
Greetings! I need help connecting to a second remote server. The way I usually work with the EG is I set up the Tools > Connections > Profiles and save the remote server, my username and password. However, this time I need to connect to a second server (with another address, username and password) while still connected to the main one. The username and password are the same between servers. Is there any way for me to do this? I need to use files which are in both servers, and want to remove any manual intervention from the process (i.e. copying the table manually). Thank you!
... View more
12-15-2017
10:25 AM
Thanks a lot, @ballardw. However, this still has one slight problem with my intended use. With it, I have to run a subquery everytime I need to use the variable. Since the table I am going to be using is fairly large, making several subqueries would be time costly. I would need a way to store it into a variable, such as: %let largest = %maxmin(sashelp.class, age); then, I could run the query just once and use the &largest. wherever I needed it.
... View more
12-14-2017
12:42 PM
Hi ballardw, thanks for your reply. Being more specific, it doesn't work because, as you pointed out, PROC FCMP can't deal with PROC SQL commands inside it. The snippet I offered was meant to convey the idea of what I need. I need a simple function that can return the max value from a column in a table. I meant to use it as something like: PROC SQL;
CREATE TABLE work.op1 AS
SELECT
*
FROM
work.input1
WHERE
date_updated = get_max(other_table, date_updated);
QUIT; assuming the get_max from original post had worked. Your macro suggestion is something that had occured to me, but I mean to write a function and store it so everyone in my work group could use, rather than everyone having to include and run macros that use global variables. I hope I was clear with what I need.
... View more
12-14-2017
12:18 PM
Hi. I need some help getting the max value from a column in a table. I initially tried writing a function as such: PROC FCMP OUTLIB=work.func.test;
FUNCTION get_max(table $, column $);
PROC SQL;
SELECT MAX(column) INTO :ret FROM table;
QUIT;
RETURN ret;
ENDSUB;
RUN; But it doesn't work. Any ideas? Thanks in advance.
... View more
12-12-2017
01:06 PM
Hi, I'm trying to define a function with an optional parameter. My goal with the function is to return either the MAX or MIN value of a column, given the choice of the parameter. But it could be omitted, and it would default to returning the MAX value. I'm trying to do something like this: PROC FCMP OUTLIB=work.func.test; FUNCTION get_extreme(table $, column $, type);
IF type = 1 /* or not informed */
PROC SQL;
SELECT MAX(column) INTO :ret FROM table;
QUIT;
ELSE
PROC SQL;
SELECT MIN(column) INTO :ret FROM table;
QUIT;
RETURN ret;
ENDSUB;
RUN; So, assuming I have a simple table, like this: +---------------+
| date | value |
+---------------+
| 20820 | 1000 |
| 20821 | 850 |
| 20822 | 1100 |
| 20823 | 900 |
+---------------+ I could use the function and would get these results: %put %sysfunc(get_extreme(table, date));
/* Output should be 20823 */
%put %sysfunc(get_extreme(table, value, 0));
/* Output should be 850 */
%put %sysfunc(get_extreme(table, date, 1));
/* Output should again be 20823 */ Can anyone help me? Thanks in advance.
... View more