vseshad Tracker
https://communities.sas.com/kntur85557/tracker
vseshad TrackerSat, 14 Sep 2024 07:14:31 GMT2024-09-14T07:14:31ZRe: combining datasets
https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/493858#M130025
<P>This works like a charm, thank you so much. </P>Sun, 09 Sep 2018 01:07:01 GMThttps://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/493858#M130025vseshad2018-09-09T01:07:01Zcombining datasets
https://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/493839#M130009
<P><SPAN>Dataset A has 1000 observations and dataset B has 50 observations and they have no common variables. Is there a way I can combine the 2 datasets such that the same 50 observations of dataset B gets repeated for every 50 observations of dataset A? I also want to label the first 50 observations of the new dataset as 1, the next 50 observations as 2 and so on. Thanks!</SPAN></P>Sat, 08 Sep 2018 23:08:28 GMThttps://communities.sas.com/t5/SAS-Programming/combining-datasets/m-p/493839#M130009vseshad2018-09-08T23:08:28ZRe: Merging 2 datasets
https://communities.sas.com/t5/SAS-Programming/Merging-2-datasets/m-p/493006#M129673
<P>I haven't had a chance to test this code yet, I will try it and let you know if it works. But thank you so much for your reply. </P>Thu, 06 Sep 2018 13:20:41 GMThttps://communities.sas.com/t5/SAS-Programming/Merging-2-datasets/m-p/493006#M129673vseshad2018-09-06T13:20:41ZRe: Merging 2 datasets
https://communities.sas.com/t5/SAS-Programming/Merging-2-datasets/m-p/493005#M129672
<P>I'm sorry I wasn't very clear.</P><P> </P><P>What I am trying to do with the column calculation is trying to arrange the first value of the 4 plates into a square. Hence A01 of plate 1 becomes A01 of newplate1, A01 of plate 2 becomes A02 of newplate1, <SPAN>A01 of plate3 becomes B01 of newplate 1, and A01 of plate4 </SPAN>becomes B02 of newplate1. </P><P> </P><P>The new plate should look something like this. Every row is labeled A-P and every column on the new plate is labeled 1-24. Please let me know if this is helpful. Thanks!</P><P> </P><TABLE><TBODY><TR><TD>1A1</TD><TD>2A1</TD><TD>1A2</TD><TD>2A2</TD><TD>1A3</TD><TD>2A3</TD><TD>1A4</TD><TD>2A4</TD><TD>1A5</TD><TD>2A5</TD><TD>1A6</TD><TD>2A6</TD><TD>1A7</TD><TD>2A7</TD><TD>1A8</TD><TD>2A8</TD><TD>1A9</TD><TD>2A9</TD><TD>1A10</TD><TD>2A10</TD><TD>1A11</TD><TD>2A11</TD><TD>1A12</TD><TD>2A12</TD></TR><TR><TD>3A1</TD><TD>4A1</TD><TD>3A2</TD><TD>4A2</TD><TD>3A3</TD><TD>4A3</TD><TD>3A4</TD><TD>4A4</TD><TD>3A5</TD><TD>4A5</TD><TD>3A6</TD><TD>4A6</TD><TD>3A7</TD><TD>4A7</TD><TD>3A8</TD><TD>4A8</TD><TD>3A9</TD><TD>4A9</TD><TD>3A10</TD><TD>4A10</TD><TD>3A11</TD><TD>4A11</TD><TD>3A12</TD><TD>4A12</TD></TR><TR><TD>1B1</TD><TD>2B1</TD><TD>1B2</TD><TD>2B2</TD><TD>1B3</TD><TD>2B3</TD><TD>1B4</TD><TD>2B4</TD><TD>1B5</TD><TD>2B5</TD><TD>1B6</TD><TD>2B6</TD><TD>1B7</TD><TD>2B7</TD><TD>1B8</TD><TD>2B8</TD><TD>1B9</TD><TD>2B9</TD><TD>1B10</TD><TD>2B10</TD><TD>1B11</TD><TD>2B11</TD><TD>1B12</TD><TD>2B12</TD></TR><TR><TD>3B1</TD><TD>4B1</TD><TD>3B2</TD><TD>4B2</TD><TD>3B3</TD><TD>4B3</TD><TD>3B4</TD><TD>4B4</TD><TD>3B5</TD><TD>4B5</TD><TD>3B6</TD><TD>4B6</TD><TD>3B7</TD><TD>4B7</TD><TD>3B8</TD><TD>4B8</TD><TD>3B9</TD><TD>4B9</TD><TD>3B10</TD><TD>4B10</TD><TD>3B11</TD><TD>4B11</TD><TD>3B12</TD><TD>4B12</TD></TR><TR><TD>1C1</TD><TD>2C1</TD><TD>1C2</TD><TD>2C2</TD><TD>1C3</TD><TD>2C3</TD><TD>1C4</TD><TD>2C4</TD><TD>1C5</TD><TD>2C5</TD><TD>1C6</TD><TD>2C6</TD><TD>1C7</TD><TD>2C7</TD><TD>1C8</TD><TD>2C8</TD><TD>1C9</TD><TD>2C9</TD><TD>1C10</TD><TD>2C10</TD><TD>1C11</TD><TD>2C11</TD><TD>1C12</TD><TD>2C12</TD></TR><TR><TD>3C1</TD><TD>4C1</TD><TD>3C2</TD><TD>4C2</TD><TD>3C3</TD><TD>4C3</TD><TD>3C4</TD><TD>4C4</TD><TD>3C5</TD><TD>4C5</TD><TD>3C6</TD><TD>4C6</TD><TD>3C7</TD><TD>4C7</TD><TD>3C8</TD><TD>4C8</TD><TD>3C9</TD><TD>4C9</TD><TD>3C10</TD><TD>4C10</TD><TD>3C11</TD><TD>4C11</TD><TD>3C12</TD><TD>4C12</TD></TR><TR><TD>1D1</TD><TD>2D1</TD><TD>1D2</TD><TD>2D2</TD><TD>1D3</TD><TD>2D3</TD><TD>1D4</TD><TD>2D4</TD><TD>1D5</TD><TD>2D5</TD><TD>1D6</TD><TD>2D6</TD><TD>1D7</TD><TD>2D7</TD><TD>1D8</TD><TD>2D8</TD><TD>1D9</TD><TD>2D9</TD><TD>1D10</TD><TD>2D10</TD><TD>1D11</TD><TD>2D11</TD><TD>1D12</TD><TD>2D12</TD></TR><TR><TD>3D1</TD><TD>4D1</TD><TD>3D2</TD><TD>4D2</TD><TD>3D3</TD><TD>4D3</TD><TD>3D4</TD><TD>4D4</TD><TD>3D5</TD><TD>4D5</TD><TD>3D6</TD><TD>4D6</TD><TD>3D7</TD><TD>4D7</TD><TD>3D8</TD><TD>4D8</TD><TD>3D9</TD><TD>4D9</TD><TD>3D10</TD><TD>4D10</TD><TD>3D11</TD><TD>4D11</TD><TD>3D12</TD><TD>4D12</TD></TR><TR><TD>1E1</TD><TD>2E1</TD><TD>1E2</TD><TD>2E2</TD><TD>1E3</TD><TD>2E3</TD><TD>1E4</TD><TD>2E4</TD><TD>1E5</TD><TD>2E5</TD><TD>1E6</TD><TD>2E6</TD><TD>1E7</TD><TD>2E7</TD><TD>1E8</TD><TD>2E8</TD><TD>1E9</TD><TD>2E9</TD><TD>1E10</TD><TD>2E10</TD><TD>1E11</TD><TD>2E11</TD><TD>1E12</TD><TD>2E12</TD></TR><TR><TD>3E1</TD><TD>4E1</TD><TD>3E2</TD><TD>4E2</TD><TD>3E3</TD><TD>4E3</TD><TD>3E4</TD><TD>4E4</TD><TD>3E5</TD><TD>4E5</TD><TD>3E6</TD><TD>4E6</TD><TD>3E7</TD><TD>4E7</TD><TD>3E8</TD><TD>4E8</TD><TD>3E9</TD><TD>4E9</TD><TD>3E10</TD><TD>4E10</TD><TD>3E11</TD><TD>4E11</TD><TD>3E12</TD><TD>4E12</TD></TR><TR><TD>1F1</TD><TD>2F1</TD><TD>1F2</TD><TD>2F2</TD><TD>1F3</TD><TD>2F3</TD><TD>1F4</TD><TD>2F4</TD><TD>1F5</TD><TD>2F5</TD><TD>1F6</TD><TD>2F6</TD><TD>1F7</TD><TD>2F7</TD><TD>1F8</TD><TD>2F8</TD><TD>1F9</TD><TD>2F9</TD><TD>1F10</TD><TD>2F10</TD><TD>1F11</TD><TD>2F11</TD><TD>1F12</TD><TD>2F12</TD></TR><TR><TD>3F1</TD><TD>4F1</TD><TD>3F2</TD><TD>4F2</TD><TD>3F3</TD><TD>4F3</TD><TD>3F4</TD><TD>4F4</TD><TD>3F5</TD><TD>4F5</TD><TD>3F6</TD><TD>4F6</TD><TD>3F7</TD><TD>4F7</TD><TD>3F8</TD><TD>4F8</TD><TD>3F9</TD><TD>4F9</TD><TD>3F10</TD><TD>4F10</TD><TD>3F11</TD><TD>4F11</TD><TD>3F12</TD><TD>4F12</TD></TR><TR><TD>1G1</TD><TD>2G1</TD><TD>1G2</TD><TD>2G2</TD><TD>1G3</TD><TD>2G3</TD><TD>1G4</TD><TD>2G4</TD><TD>1G5</TD><TD>2G5</TD><TD>1G6</TD><TD>2G6</TD><TD>1G7</TD><TD>2G7</TD><TD>1G8</TD><TD>2G8</TD><TD>1G9</TD><TD>2G9</TD><TD>1G10</TD><TD>2G10</TD><TD>1G11</TD><TD>2G11</TD><TD>1G12</TD><TD>2G12</TD></TR><TR><TD>3G1</TD><TD>4G1</TD><TD>3G2</TD><TD>4G2</TD><TD>3G3</TD><TD>4G3</TD><TD>3G4</TD><TD>4G4</TD><TD>3G5</TD><TD>4G5</TD><TD>3G6</TD><TD>4G6</TD><TD>3G7</TD><TD>4G7</TD><TD>3G8</TD><TD>4G8</TD><TD>3G9</TD><TD>4G9</TD><TD>3G10</TD><TD>4G10</TD><TD>3G11</TD><TD>4G11</TD><TD>3G12</TD><TD>4G12</TD></TR><TR><TD>1H1</TD><TD>2H1</TD><TD>1H2</TD><TD>2H2</TD><TD>1H3</TD><TD>2H3</TD><TD>1H4</TD><TD>2H4</TD><TD>1H5</TD><TD>2H5</TD><TD>1H6</TD><TD>2H6</TD><TD>1H7</TD><TD>2H7</TD><TD>1H8</TD><TD>2H8</TD><TD>1H9</TD><TD>2H9</TD><TD>1H10</TD><TD>2H10</TD><TD>1H11</TD><TD>2H11</TD><TD>1H12</TD><TD>2H12</TD></TR><TR><TD>3H1</TD><TD>4H1</TD><TD>3H2</TD><TD>4H2</TD><TD>3H3</TD><TD>4H3</TD><TD>3H4</TD><TD>4H4</TD><TD>3H5</TD><TD>4H5</TD><TD>3H6</TD><TD>4H6</TD><TD>3H7</TD><TD>4H7</TD><TD>3H8</TD><TD>4H8</TD><TD>3H9</TD><TD>4H9</TD><TD>3H10</TD><TD>4H10</TD><TD>3H11</TD><TD>4H11</TD><TD>3H12</TD><TD>4H12</TD></TR></TBODY></TABLE>Thu, 06 Sep 2018 13:18:00 GMThttps://communities.sas.com/t5/SAS-Programming/Merging-2-datasets/m-p/493005#M129672vseshad2018-09-06T13:18:00ZMerging 2 datasets
https://communities.sas.com/t5/SAS-Programming/Merging-2-datasets/m-p/492857#M129609
<P>Hello all,</P><P> </P><P>I am an occasional dabbler of SAS and I am currently stuck on trying to find a solution to my problem.</P><P> </P><P>I have a rather large excel sheet with many variables which I managed to import into SAS. For convenience sake, I am going to say that I have a dataset with 640 observations and 2 variables. The two variables are plate and well. I want to create a new dataset where I am combining every 4 plates into one plate and I want to add 2 new variables row and column. </P><P>Part of my Dataset :</P><TABLE border="0" cellspacing="0" cellpadding="0"><TBODY><TR><TD>Plate</TD><TD>Well</TD></TR><TR><TD>1</TD><TD>A02</TD></TR><TR><TD>2</TD><TD>A02</TD></TR><TR><TD>3</TD><TD>A02</TD></TR><TR><TD>4</TD><TD>A02</TD></TR><TR><TD>1</TD><TD>A03</TD></TR><TR><TD>2</TD><TD>A03</TD></TR><TR><TD>3</TD><TD>A03</TD></TR><TR><TD>4</TD><TD>A03</TD></TR></TBODY></TABLE><P><BR />portion of Dataset i need:</P><TABLE border="0" cellspacing="0" cellpadding="0"><TBODY><TR><TD>Plate</TD><TD>Well</TD><TD>Row</TD><TD>Column</TD><TD>new plate no</TD></TR><TR><TD>1</TD><TD>A02</TD><TD>A</TD><TD>3</TD><TD>1</TD></TR><TR><TD>2</TD><TD>A02</TD><TD>A</TD><TD>4</TD><TD>1</TD></TR><TR><TD>3</TD><TD>A02</TD><TD>B</TD><TD>3</TD><TD>1</TD></TR><TR><TD>4</TD><TD>A02</TD><TD>B</TD><TD>4</TD><TD>1</TD></TR><TR><TD>1</TD><TD>A03</TD><TD>A</TD><TD>5</TD><TD>1</TD></TR><TR><TD>2</TD><TD>A03</TD><TD>A</TD><TD>6</TD><TD>1</TD></TR><TR><TD>3</TD><TD>A03</TD><TD>B</TD><TD>5</TD><TD>1</TD></TR><TR><TD>4</TD><TD>A03</TD><TD>B</TD><TD>6</TD><TD>1</TD></TR></TBODY></TABLE><P> </P><P>Every plate in the original dataset has 80 observations and I want to combine 4x80 into 1 plate with 320 values, combine the next 320 values into a second plate and so on. </P><P> </P><P>My original plan was to create a second dataset with the additional 3 observations and do a one to one merge, save it, delete those observations from original dataset and repeat but I have too many observations to do it this way and my method is also very error prone. I am sure that there is a better way of doing this, I am just not able to figure it out.</P><P> </P><P>I have attached an excel sheet which has 80 observations to better understand the pattern that I am trying to create.Would someone be able to help me out with this? Please let me know if I need to provide more information/make my question clearer. Thank you so much.</P>Thu, 06 Sep 2018 01:30:09 GMThttps://communities.sas.com/t5/SAS-Programming/Merging-2-datasets/m-p/492857#M129609vseshad2018-09-06T01:30:09ZRe: Array subscript out of range
https://communities.sas.com/t5/SAS-Programming/Array-subscript-out-of-range/m-p/440894#M282513
<P>Thank you so much for taking the time to explain. I really appreciate all your help. </P>Wed, 28 Feb 2018 14:24:25 GMThttps://communities.sas.com/t5/SAS-Programming/Array-subscript-out-of-range/m-p/440894#M282513vseshad2018-02-28T14:24:25ZRe: Array subscript out of range
https://communities.sas.com/t5/SAS-Programming/Array-subscript-out-of-range/m-p/440302#M282510
<P>Thank you so much RW9. But if I could bother you just a little bit more, I don't understand how the same year is repeated 4 times. This is exactly what I want but I am not clear how that is happening. Also, shouldn't I have to specify that the array is character array? I apologize if I am asking too many questions or if my questions are too basic. </P>Mon, 26 Feb 2018 18:56:28 GMThttps://communities.sas.com/t5/SAS-Programming/Array-subscript-out-of-range/m-p/440302#M282510vseshad2018-02-26T18:56:28ZRe: Array subscript out of range
https://communities.sas.com/t5/SAS-Programming/Array-subscript-out-of-range/m-p/440190#M282507
<P>Thanks Astounding. I can see that I need to be more careful when writing the programs. </P>Mon, 26 Feb 2018 14:45:00 GMThttps://communities.sas.com/t5/SAS-Programming/Array-subscript-out-of-range/m-p/440190#M282507vseshad2018-02-26T14:45:00ZRe: Array subscript out of range
https://communities.sas.com/t5/SAS-Programming/Array-subscript-out-of-range/m-p/440189#M282506
<P>Thanks RW9. So my dataset two looks like this:</P><P> </P><P>data two;</P><P> input year var1 $ var2 $ var3 $ var4 $;</P><P>cards;</P><P>2016 john jack sarah susan</P><P>2015 ben bill britney anne</P><P>2014 chris peter monica robin</P><P>2013 jeff matt christie christine</P><P>2012 mike david dia diane</P><P>;</P><P>run;</P><P> </P><P>dataset one should look like this:</P><P>year gender color team</P><P>2016 male red John</P><P>2016 male green Jack</P><P>2016 female red Sarah</P><P>2016 female green Susan</P><P> </P><P> </P><P>Please let me know if I should provide more information. Thanks again</P><P> </P>Mon, 26 Feb 2018 14:43:58 GMThttps://communities.sas.com/t5/SAS-Programming/Array-subscript-out-of-range/m-p/440189#M282506vseshad2018-02-26T14:43:58ZArray subscript out of range
https://communities.sas.com/t5/SAS-Programming/Array-subscript-out-of-range/m-p/440175#M282503
<P>Hi everyone, </P><P>I keep getting errors when I run the following program. Dataset two has 5 variables, year, var1-var4 and 5 observations. The dataset one that I am trying to create should have 20 observations with variables year, gender, color and team. I want to split var1-var4 for for the two genders and 2 colors and do the same for each of the five years(2016-2012). But everytime i run this program i get an error that the array subscript is out of range. It feel like I am making a logic mistake somewhere but am not able to figure out where. </P><P>data one;</P><P> set two;</P><P> array tm (*) $ var1 var2 var3 var4;</P><P> do year=2016 to 2012 by -1;</P><P> do gender="Male","Female";</P><P> do color="Red","Green";</P><P> team=tm(year);</P><P> output;</P><P> end;</P><P> end;</P><P>end;</P><P>run;</P><P> </P><P>What I want:</P><P>dataset one:</P><P>year gender color team</P><P>2016 male red var1 value</P><P>2016 male green var2 value</P><P>2016 female red var3 value</P><P>2016 female green var4 value</P><P>and so on.</P><P> </P><P>Any input is much appreciated. Thanks!</P>Mon, 26 Feb 2018 13:37:08 GMThttps://communities.sas.com/t5/SAS-Programming/Array-subscript-out-of-range/m-p/440175#M282503vseshad2018-02-26T13:37:08ZRe: %include question
https://communities.sas.com/t5/SAS-Programming/include-question/m-p/440149#M282492
<P>Thank you Reeza. I understand this a lot better now</P>Mon, 26 Feb 2018 11:05:08 GMThttps://communities.sas.com/t5/SAS-Programming/include-question/m-p/440149#M282492vseshad2018-02-26T11:05:08ZRe: %include question
https://communities.sas.com/t5/SAS-Programming/include-question/m-p/440024#M282489
<P>Thank you for your reply. I am trying to understand what would be the best way to use %include to refer a macro. I understand from your reply that %include isn't the best solution to refer a stored macro but if I still want to use %include, how would I go about doing it? Thank you again for your reply. Users such as yourself are a huge help to novices like me.</P>Sun, 25 Feb 2018 13:46:20 GMThttps://communities.sas.com/t5/SAS-Programming/include-question/m-p/440024#M282489vseshad2018-02-25T13:46:20Z%include question
https://communities.sas.com/t5/SAS-Programming/include-question/m-p/440002#M282487
<P>Can I create a macro1 with a %include statement referencing macro2 that is stored in macro catalog location? Or do I need to store macro2 as a sas file for me to be able to use %include statement?</P><P> </P><P>For example: </P><P>options mstored sasmstore=test;</P><P>libname test "c:/desktop/test";</P><P> </P><P>%macro macro1/store source;</P><P> proc print data=test;</P><P>run;</P><P>%mend;</P><P> </P><P>%macro macro2;</P><P>%include "c:\desktop\macro1.sas"; <----- Is is possible for me to refer to macro1 like this? Or should I save all the above code in a file %mend; and refer that file?</P><P> </P><P>Thank you.</P><P> </P><P> </P><P> </P>Sun, 25 Feb 2018 05:08:38 GMThttps://communities.sas.com/t5/SAS-Programming/include-question/m-p/440002#M282487vseshad2018-02-25T05:08:38ZRe: call routine vs function
https://communities.sas.com/t5/SAS-Programming/call-routine-vs-function/m-p/435060#M281967
Thank you for answering my questionWed, 07 Feb 2018 20:55:27 GMThttps://communities.sas.com/t5/SAS-Programming/call-routine-vs-function/m-p/435060#M281967vseshad2018-02-07T20:55:27ZRe: call routine vs function
https://communities.sas.com/t5/SAS-Programming/call-routine-vs-function/m-p/435057#M281966
Thank you so much for your explanation. I don’t have a specific routine that I want to use but was rather just trying to understand why I couldn’t use it. Thanks again.Wed, 07 Feb 2018 20:54:30 GMThttps://communities.sas.com/t5/SAS-Programming/call-routine-vs-function/m-p/435057#M281966vseshad2018-02-07T20:54:30Zcall routine vs function
https://communities.sas.com/t5/SAS-Programming/call-routine-vs-function/m-p/434631#M281963
<P>Hello,</P><P> </P><P>I'm relatively new to SAS and am not able to understand why I cannot use call routines in assignment statements or expressions. Could someone please explain why? Thanks!</P>Tue, 06 Feb 2018 18:20:59 GMThttps://communities.sas.com/t5/SAS-Programming/call-routine-vs-function/m-p/434631#M281963vseshad2018-02-06T18:20:59ZRe: how to calculate average of a subset
https://communities.sas.com/t5/SAS-Programming/how-to-calculate-average-of-a-subset/m-p/350475#M273656
<P>I apologize if it seems ambiguous. I want to divide each person's value by Jason's average. </P>Mon, 17 Apr 2017 11:16:25 GMThttps://communities.sas.com/t5/SAS-Programming/how-to-calculate-average-of-a-subset/m-p/350475#M273656vseshad2017-04-17T11:16:25Zhow to calculate average of a subset
https://communities.sas.com/t5/SAS-Programming/how-to-calculate-average-of-a-subset/m-p/350398#M273652
<P>Hello, </P><P> </P><P>I am pretty new to SAS and I need help in some basic calculations. I want to calculate the average of a subset of numbers in a column and divide every value of that column by the average.</P><P>For example, I have a table </P><P>name age</P><P>julia 45</P><P>julia 54</P><P>julia 34</P><P>julia 45</P><P>jason 23</P><P>jason 56</P><P>julia 23</P><P>jason 11</P><P>jason 34</P><P>julia 22</P><P>alec 31</P><P>alex 33</P><P>matt 28</P><P>jason 29</P><P> </P><P>I want to calculate the average age of Jason and divide every value of age by the average. What is the easiest way to do this and is this something that can be done with proc sql? Thanks in advance for your help!</P>Sun, 16 Apr 2017 22:28:42 GMThttps://communities.sas.com/t5/SAS-Programming/how-to-calculate-average-of-a-subset/m-p/350398#M273652vseshad2017-04-16T22:28:42Z