02-22-2018
SmcGarrett
Obsidian | Level 7
Member since
04-07-2016
- 41 Posts
- 6 Likes Given
- 1 Solutions
- 3 Likes Received
-
Latest posts by SmcGarrett
Subject Views Posted 5411 02-22-2018 03:25 PM 5418 02-22-2018 03:01 PM 5420 02-22-2018 02:59 PM 5444 02-22-2018 02:33 PM 3670 12-15-2017 01:58 PM 3811 12-14-2017 01:44 PM 3842 12-14-2017 12:55 PM 1129 09-12-2017 12:08 PM 1212 09-11-2017 08:14 PM 1449 02-06-2017 06:47 PM -
Activity Feed for SmcGarrett
- Posted Re: Create if statements based on value of macro parameter on SAS Programming. 02-22-2018 03:25 PM
- Posted Re: Create if statements based on value of macro parameter on SAS Programming. 02-22-2018 03:01 PM
- Posted Re: Create if statements based on value of macro parameter on SAS Programming. 02-22-2018 02:59 PM
- Posted Create if statements based on value of macro parameter on SAS Programming. 02-22-2018 02:33 PM
- Posted Re: Ignore missing table when setting multiple tables in data set on SAS Programming. 12-15-2017 01:58 PM
- Posted Re: Ignore missing table when setting multiple tables in data set on SAS Programming. 12-14-2017 01:44 PM
- Posted Ignore missing table when setting multiple tables in data set on SAS Programming. 12-14-2017 12:55 PM
- Posted Re: Pass in varying number of values for query in a Macro on SAS Programming. 09-12-2017 12:08 PM
- Posted Pass in varying number of values for query in a Macro on SAS Programming. 09-11-2017 08:14 PM
- Got a Like for Re: Creating dummy variables for multiple categories in a variable. 08-24-2017 04:17 PM
- Posted Re: Have a statement evaluated and the value be used as a macro parameter using %Let on SAS Programming. 02-06-2017 06:47 PM
- Posted Re: Have a statement evaluated and the value be used as a macro parameter using %Let on SAS Programming. 02-06-2017 06:24 PM
- Posted Have a statement evaluated and the value be used as a macro parameter using %Let on SAS Programming. 02-06-2017 05:09 PM
- Posted Working with independent(exogenous) variables that are functions of one another on Statistical Procedures. 01-23-2017 01:34 PM
- Posted Re: Panel Model to Disaggregate Combined Effects (Probability) on SAS Forecasting and Econometrics. 08-11-2016 06:31 PM
- Posted Panel Model to Disaggregate Combined Effects (Probability) on SAS Forecasting and Econometrics. 08-08-2016 05:16 PM
- Posted Re: Using a macro call to execute different processes based on the value of the macro call. on SAS Enterprise Guide. 08-02-2016 05:29 PM
- Got a Like for Re: Using a macro call to execute different processes based on the value of the macro call.. 08-02-2016 05:16 PM
- Liked Re: Using a macro call to execute different processes based on the value of the macro call. for TomKari. 08-02-2016 05:14 PM
- Posted Re: Using a macro call to execute different processes based on the value of the macro call. on SAS Enterprise Guide. 08-02-2016 05:13 PM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 2 1 1 -
My Liked Posts
Subject Likes Posted 1 08-02-2016 05:13 PM 2 07-15-2016 01:46 PM
02-22-2018
03:25 PM
OMG I knew it was something simple. Was way overthinking it! Thank you!
... View more
02-22-2018
03:01 PM
Ah...I see...that was a typo. It would not be dependent on Response...ONLY ClientCode. Sorry.
... View more
02-22-2018
02:59 PM
The Value would be a string of 4 characters that are a code for the client. Some clients calculate their total budget based on different combinations of Variables
... View more
02-22-2018
02:33 PM
I have a macro program that I've written that uses multiple parameters. One of these parameters is the clients' name. The macro looks something like this: %macro Program( CampaignCode, ClientCode, Start, End, Response ) The commands that are called using the macro are pages and pages long but there is a certain place where I want to create a set of conditional statements for calculations based on the value of &ClientCode. Basically something like this data work.want; set work.have; if &ClientCode = "Client1" then Calculation = VAR1 +VAR2+VAR3; else if &ClientCode= "Client2" then Calculation = VAR1 + VAR3 + VAR4; else if &ClientCode = "Client3" then Calculation = Var2 + VAR4 + VAR6; .....; run; But that is not working correctly. I feel like this is a relatively simple command I am trying to execute. Can someone show me the correct synthax? Thanks
... View more
12-15-2017
01:58 PM
Thanks for the help everyone. I am going to test these out and let you guys know what worked best. Thanks, Michael
... View more
12-14-2017
01:44 PM
This makes sense. Is it possible to create a temporary library other than the WORK library in SAS? Or would I have to create a physical location for the library?
... View more
12-14-2017
12:55 PM
I have a script that 95% of the time works perfectly but every now and then there is an error that causes the entire program to stop. My code runs 42 regressions and the results from these regressions are placed in 42 individual tables and then those 42 tables are appended to one another to make a master table. Some times there is no data for 1 or more of the 42 regressions so no table is produced. If one or more of the 42 tables does not exist, the program hits an error when the 42 tables are appended together. data work.appended; set work.monday_em_t work.monday_da_t work.monday_ef_t work.monday_pr_t work.monday_lf_t work.monday_ov_t work.tuesday_em_t work.tuesday_da_t work.tuesday_ef_t work.tuesday_pr_t work.tuesday_lf_t work.tuesday_ov_t work.wednesday_em_t work.wednesday_da_t work.wednesday_ef_t work.wednesday_pr_t work.wednesday_lf_t work.wednesday_ov_t work.thursday_em_t work.thursday_da_t work.thursday_ef_t work.thursday_pr_t work.thursday_lf_t work.thursday_ov_t work.friday_em_t work.friday_da_t work.friday_ef_t work.friday_pr_t work.friday_lf_t work.friday_ov_t work.saturday_em_t work.saturday_da_t work.saturday_ef_t work.saturday_pr_t work.saturday_lf_t work.saturday_ov_t work.sunday_em_t work.sunday_da_t work.sunday_ef_t work.sunday_pr_t work.sunday_lf_t work.sunday_ov_t; run; For instance, if there is no "work.saturday_em_t" table, the code above will create an error and not produce an appended file. I would like for the code to just ignore if a table is missing and append all tables that do exist without stopping the program. Is this possible?
... View more
09-12-2017
12:08 PM
Thanks for the response. This gives me a lot to work with. The part that I may have been unclear about is that sometimes I may want to query more than one of any of these parameters. I will always ONLY want one Company but sometimes 2 or more products and most of the time 2 or more campaigns. Therefore, I'd like information on how to potentially pass a "list of values" through a macro parameter so that they data set created contains all observations for which the values are true. Assuming we call ALL the data through the stored procedure and then use a dataset to subset the data that we do want, are you familiar with how to pass a list of values through a macro parameter? A very ugly way of doing then might be (We'd macro this at some point): %let LIST_PRODUCTS = "P_One","P_Two","P_Three"; %let LIST_CAMPAIGNS = "C_One","C_Two","C_Three"; data want; set have; where Product in (&LIST_PRODUCTS) and Campaign in (&List_CAMPAIGNS); run; However, it seems very inefficient and like there could be a better way.
... View more
09-11-2017
08:14 PM
I'm working with a stored procedure that pulls data via an ODBC connection using proc sql. In particular, there are 3 columns that hold values for which I would like to shape my query in either the proq sql step or a secondary data step. The columns are basically hierachical, Company, then Product, then Campaign. Sometimes there Company, Product, and Campaign values are all the same while other companys might have X amount of products and Y amount of campaigns. I'd like to be able to pass values to the macro via "%let" statements, but sometimes it is unnecessary and/or redundant to give values for Product and Campaign. Other times I might want to specify one product and many times I will want to specify 1 or more campaigns. The goal is to automate the query such that we can add in varying numbers of macro parameters such that if no value for a particular column is passed the query simply does not use it as a condition. For example: %let Company = ABCD; %let Product = ; %let Campaign = ; proc sql; connect to odbc (dsn='DW' uid='**********' pwd='*************'); create table work.table as select * from connection to odbc (execute GETDATA "&Company","&Product","&Campaign") ; disconnect from odbc; quit; In the case above, I would simply want the query to return me all data associated with Company ABCD. Since no Product of Campaign was assigned (or it's blank/missing), I would not want the query to subset the data based on those columns. Additionally: %let Company = EFGH; %let Product = ZYX; %let Campaign = DEF FED; proc sql; connect to odbc (dsn='DW' uid='**********' pwd='*************'); create table work.table as select * from connection to odbc (execute GETDATA "&Company","&Product","&Campaign") ; disconnect from odbc; quit; In the case above, I would simply want the query to return me all data associated with the EFGH Company for their product ZYX and the campaigns for that product of DEF and FED. It seems like it might be a better idea to execute this in a data step after the full data set has been brought in. Does anyone have an suggestions on dealing with optional macro parameters? Thanks in advance. Michael
... View more
02-06-2017
06:47 PM
It worked! It was not an issue with the where statement or it being a proc import or database. Just the formating. Thanks!
... View more
02-06-2017
06:24 PM
Hi , It seems to want to work, but it appears to be having a problem converting the numeric into a date. This is my error: ERROR: CLI prepare error: [Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data type nvarchar to datetime. SQL statement: execute InsightGetGoogleAnalytcisInfo "23JAN2017","20851". NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
... View more
02-06-2017
05:09 PM
Hello, I have what I believe is a relatively simple task. I have a program where a date variable is used as a macro parameter...something like this: %program(data_file, date_start) I want to add a let statement within the program which will essentially add days to the date variable to increase the amount of data that is processed. I'd like it to look something like: %program(data_file, date_start,numberofdays) And it will process a data step that looks something like: %let Date_end = &Date + &numberofdays; proc import datafile="Datafile" dbms=xlsx out=work.Data; sheet= "sheet1"; where Datetime >="&Date_start:6:00"DT and Datetime <= "&Date_end:5:59"DT; run; How do I make the %let statement evaluate &Date + &numberofdays???? Thanks,
... View more
01-23-2017
01:34 PM
Hello, I am working with a time series data set and am hoping someone can point me in the right direction for specifying a model considering my data. My dependent variable is the number of web visits that hit a website on a daily interval for about 1.5 years ~500 observations. My independent variables are the value of television dollars spent on about 250 different television stations. The television stations range from small reach stations to very large reach stations. Since I cannot place 250 independent variables into a regression anaysis with 500 observations I have chosen to group (cluster) stations together that are closely related in terms of reach or average price per television station. I have grouped my station variables into 7 different groups. I am initially trying to model this with an ARIMAX with distributed lags to pick up any drag behavior. However, what I am finding is that I am getting negative coeeficient for some of the group variables which theoritically does not make any sense. What I believe is happening is that the the regression is picking up the shift from an efficient TV group to a less efficient TV group; thus, it is showing me the net effect of dollars being shifted. What I am finding is that my "group" variables are additive functions of one another....as in Cost_Group1 = Total Budget - Cost_Group2 Cost_Group3 Cost_Group4 Cost_Group5 Cost_Group6 Cost_Group7. So if the true effect of 1 dollar (Group7)= 100 and the true effect of 1 dollar(Group1) = 10....then if there is a shift of dollars to Group1, the net effect is -90 and that's not actually true. So it appears my independent variables are actually endogenous with one another.... any help?
... View more
08-11-2016
06:31 PM
Hi @gergely_batho, Thanks for your response. I thought that linear regression would work as well, but it doesn't seem to be doing the trick. The problem is that the individual effects of each individual within the group have a variance of their own. This sometimes causes a particular individual to have a "negative" effect or estimated coefficient which does not make sense. In my case, the effect has to be 0 or greater. That's why I'm searching for something that will tell me the percentage of the effect an individual should get based on all the combinations of effects from all observerable groups. Michael
... View more
08-08-2016
05:16 PM
Hi All, Not looking for a lesson in stats as I am perfectly capable of researching statistical methods and I do have a background in econometrics and stats. I would however like to ask if anyone can point me in a good direction or even just giev me the name of the class of models I am describing. I have data sets that typically ranges from 1000-8000 observations. Typically there over 50-200 individuals (in my case they are marketing channels) and each has a multiple observations. Because the individual effects of each of these observations are typically grouped with the individual effects of multiple individuals, the individual effect of a station is not isolated. Instead, I buckets (if you will) of effects that I know came from Individual A, B ,G, E, and F. For example, I have 8000 Unique effects (observations) caused by 100 Individuals. On average, 5 random individuals have an effect at one time...thus, I have 8000/5 groups = 1600 groups. Group 1: Individual A, Individual B, Individual C, Individual D, Individual E Effect of Group 1: $5000 Group 2: Individual A, Individual C, Individual G, Individual H, Individual L Effect of Group 2: $4,000 Group 3: Ind. Z, E, Y, D, Q Effecot of Group 3: $8,000 So above I have 3 groups of 5 individuals whose aggregated effects are observed. My goal is to use the entire dataset to determine how much of the effect of each group was due to the individuals of the group. For Group 1, the end goal would be something like: Ind. A = 40% = $2000 Ind. B = 10% = $500 Ind. C = 15% = $750 Ind. D = 20% = $1000 Ind. E = 15% = $750 I am assuming this is going to be a probablistic model and possible a panel data model. Any suggestions?
... View more