07-11-2017
HoaTruong
Obsidian | Level 7
Member since
01-05-2017
- 16 Posts
- 9 Likes Given
- 0 Solutions
- 2 Likes Received
-
Latest posts by HoaTruong
Subject Views Posted 1466 07-07-2017 07:46 AM 1494 07-07-2017 07:10 AM 1397 03-29-2017 11:25 AM 1397 03-29-2017 11:25 AM 1427 03-29-2017 09:11 AM 1401 03-17-2017 04:50 AM 1446 03-14-2017 12:26 PM 1945 03-08-2017 09:24 AM 3092 03-07-2017 09:15 AM 3106 03-07-2017 06:31 AM -
Activity Feed for HoaTruong
- Got a Like for Link Analysis in SAS Enterprise Miner: Interpreting Results. 11-06-2019 02:11 AM
- Posted Re: Help with Macro Variables in Do-Loops on SAS Programming. 07-07-2017 07:46 AM
- Posted Help with Macro Variables in Do-Loops on SAS Programming. 07-07-2017 07:10 AM
- Posted Re: Invoke Macros using Dataset Variable Values on SAS Programming. 03-29-2017 11:25 AM
- Posted Re: Invoke Macros using Dataset Variable Values on SAS Programming. 03-29-2017 11:25 AM
- Liked Re: Invoke Macros using Dataset Variable Values for Reeza. 03-29-2017 11:25 AM
- Liked Re: Invoke Macros using Dataset Variable Values for Kurt_Bremser. 03-29-2017 11:25 AM
- Posted Invoke Macros using Dataset Variable Values on SAS Programming. 03-29-2017 09:11 AM
- Posted Re: Enterprise Miner: How to Code a Model from Rules on SAS Data Science. 03-17-2017 04:50 AM
- Liked Re: Enterprise Miner: How to Code a Model from Rules for WendyCzika. 03-17-2017 04:50 AM
- Liked Re: Stratified Random Sampling by Group for Ksharp. 03-15-2017 05:33 AM
- Posted Enterprise Miner: How to Code a Model from Rules on SAS Data Science. 03-14-2017 12:26 PM
- Posted Stratified Random Sampling by Group on SAS Programming. 03-08-2017 09:24 AM
- Posted Re: Stratified Sampling Macro on SAS Programming. 03-07-2017 09:15 AM
- Liked Re: Stratified Sampling Macro for Ksharp. 03-07-2017 06:32 AM
- Posted Re: Stratified Sampling Macro on SAS Programming. 03-07-2017 06:31 AM
- Posted Re: Stratified Sampling Macro on SAS Programming. 03-07-2017 04:15 AM
- Liked Re: Stratified Sampling Macro for Ksharp. 03-07-2017 03:55 AM
- Liked Re: Stratified Sampling Macro for art297. 03-07-2017 03:55 AM
- Posted Stratified Sampling Macro on SAS Programming. 03-06-2017 01:17 PM
-
Posts I Liked
Subject Likes Author Latest Post 1 1 1 2 1 -
My Liked Posts
Subject Likes Posted 2 01-05-2017 06:03 AM
07-07-2017
07:46 AM
Thanks for your reply. When this code is implemented, it won't know what values to use in the table beforehand. Even though, I've assigned simple values to the macro variables, the code will need to deal with any values that will passed to it.
... View more
07-07-2017
07:10 AM
Hi, I'm looking for assistance on what should hopefully be a simple question 🙂 I'm trying to build the following table, using the macro variables defined below, and the DO-loop. I'm having problems with the Target variable, as this is taking the number suffix from the loop counter... i CellID Target 1 Work.Out1 Work.Out1 2 Work.Out1 Work.Out2 3 Work.Out1 Work.Out3 4 Work.Out1 Work.Out4 %LET NUMROWS=4; %LET OUTTABLE1=Work.Out1; %LET OUTTABLE2=Work.Out2; %LET OUTTABLE3=Work.Out3; %LET OUTTABLE4=Work.Out4; Data Cell_Splits; DO i=1 TO &NUMROWS; CellID = "&OUTTABLE1"; Target = "&OUTTABLE&i"; Output; END; Run; Any help would be greatly appreciated! Many thanks
... View more
03-29-2017
11:25 AM
Thank you very much - just what I needed!
... View more
03-29-2017
11:25 AM
Thank you very much - this is a great alternative solution!
... View more
03-29-2017
09:11 AM
Hi, Please can you help with the following query. I have a 'control' dataset with two variables Condition_1 and Condition_2. The table looks a bit like the following example: Condition_1 Condition2 1 2 3 5 4 6 I also have a 'base' dataset that resembles the following: Condition Person Merge_Variable 1 1 9 1 2 9 2 3 0 2 4 0 2 5 8 2 6 7 2 7 5 3 8 4 3 9 1 3 10 2 3 11 5 4 12 0 4 13 2 4 14 3 4 15 7 5 16 9 5 17 0 5 18 3 5 19 8 6 20 7 6 21 5 I have a macro that takes two parameters and creates a new dataset. The new dataset is the result of merging two datasets - one that is created from the base table by filtering by Condition = &a; the other is created from the base table by filtering by Condition = &b. %MACRO MERGE(a, b); Data temp1; Set BASE_TABLE (Where = (Condition = &a)); Run; Data temp2; Set BASE_TABLE (Where = (Condition = &b)); Run; Proc Sort Data = temp1; By Merge_Variable; Run; Proc Sort Data = temp2; By Merge_Variable; Run; Data Combined_&a._&b; Merge temp1 (In = A) temp1 (In = B) ; By Merge_Variable; If A AND B; Run; %MEND MERGE; Please can you help me write some code that takes each row of the 'control' table, and invokes this MERGE macro - by passing the values of variables Condition_1 and Condition_2. Many thanks, Hoa
... View more
03-17-2017
04:50 AM
Thank you very much!
... View more
03-14-2017
12:26 PM
Hi, I was wondering if anyone could please let me know if the following would be possible. I've been given a model in the form of a regression equation: Coefficient_1, Variable_1 Coefficient_2, Variable_2 ... ... Coefficient_n, Variable_n I would like to input this into SAS Enterprise Miner to create some sort of model scoring node. Once the model has been successfully input into Miner, I would like to export this as a PMML file. I'm planning to add the following code to the Project Start script: %let EM_PMML=Y; Any help would be much appreciated. Many thanks, Hoa
... View more
03-08-2017
09:24 AM
Hi, I'd like to request some assistance with the following programming query. I have an input dataset (please see attachement) - small sample provided below. It consists of one row per person. Each row belongs to a specific campaign cell and is given a model score (values from 1 - 10). Cell Individual ModelScore 100 Person1 1 100 Person2 2 100 Person3 3 100 Person4 4 100 Person5 5 100 Person6 6 100 Person7 7 100 Person8 8 100 Person9 9 100 Person10 10 100 Person11 1 100 Person12 2 101 Person13 3 101 Person14 4 101 Person15 5 101 Person16 6 101 Person17 7 102 Person18 8 102 Person19 9 102 Person20 10 For each value of Cell, I would like to perform a random stratified (strata variable: ModelScore) sample to split the data into 20 roughly equal-sized groups. For example, the subset of rows that belong to cell 100 will be split into 20 groups, using the ModelScore variable. I would like this to be repeated for each value of Cell in the input dataset. I was thinking of using PROC SURVEYSELECT with the GROUPS= option, but wasn't sure if there is a better approach. Many thanks, Hoa
... View more
03-07-2017
06:31 AM
Thank you very much for the quick response! I'll give it a try and will report back!
... View more
03-07-2017
04:15 AM
Thank you both for your quick and helpful replies - I really appreciate it! Apologies if I'm misunderstanding, but I'm wondering how I can apply the sampling logic you've provided to my input dataset. In addition to the 'control' table below... Group EndGroup Percent 1 1 0.25 1 2 0.25 1 3 0.25 1 4 0.25 5 5 0.5 5 6 0.25 5 7 0.25 I also have an input dataset (please see the attached file). The input dataset contains one row per individual. Based on the control table above, I would like to split the existing groups into sub-groups, using the stratified sampling procedure. There are 42 individuals belonging to group 1 in the input table. I would like these to be split into 4 groups: 1 - containing roughly 25% of the original group 1 2 - containing roughly 25% of the original group 1 3 - containing roughly 25% of the original group 1 4 - containing roughly 25% of the original group 1 Similarly, there are 234 individuals belonging to group 5 in the input table. I would like these split into 3 groups: 5 - containing roughly 50% of the original group 5 6 - containing roughly 25% of the original group 5 7 - containing roughly 25% of the original group 5 On the input dataset, I have a variable called Score_Band (with possible values 'A', 'B' and 'C'). When I'm splitting the dataset, I like the sampling to be stratified using Score_Band. I'm aiming to have an output dataset that is the same as the input dataset, but with a new group variable added - based on the new splits. Thanks again for your help - I really appreciate it!
... View more
03-06-2017
01:17 PM
Hi, Please can you help me with the following programming task. I have an individual-level (1 row per person) dataset that contains a Group ID variable. Depending on the value of the Group ID, I would like to split the group using stratified random sampling (stratification variable: Score_Band). The groups that require splitting and the manner of the split are provided in a 'control' dataset, as follows: StartGroup EndGroup Percent 1 1 25 1 2 25 1 3 25 1 4 25 5 5 50 5 6 25 5 7 25 In the above example table, the subset of individuals belonging to group 1 are to be split across 4 groups (labelled 1 - 4), each containing 25% of the volume. Individuals belonging to group 5 are to be split into three groups (5 - 7), containing 50%, 25% and 25% of the volume, respectively. I am trying to write some code that will take an input dataset (1 row per individual) that contains an initial GroupID variable, and maps it to a new GroupID variable, based on what is specified in the 'control' table. Each split is to be based on stratified random sampling (variable Score_Band). Any help would be greatly appreciated, Hoa
... View more
03-05-2017
12:58 PM
Thank you very much! I forgot I had the quotes in the macro expression - too much staring at code..! 😃
... View more
03-04-2017
05:21 PM
Hi, I would be very grateful if someone could please help me with the following query. I have a macro variable that contains a string, but the expression contains variable names. In the example below, the macro variable contains an expression that refers to variables 'a' and 'b'. The dataset 'testdata' contains these variables. I would like to know how to set 'c' to be the numeric result of evaluating the macro variable 'test', so should equal 3. %Let test = "a+b"; Data testdata; a=1; b=2; c=???; Run; Many thanks, Hoa
... View more
01-10-2017
05:02 AM
Thanks Wendy - much appreciated!
... View more