<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How do I merge multiple variables to create multiple new variables in a data set? in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/How-do-I-merge-multiple-variables-to-create-multiple-new/m-p/930959#M11284</link>
    <description>&lt;P&gt;I am working on my dissertation.&amp;nbsp; I am tryinjg to test my hypotheses.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the program course work, we were taught to use SAS Enterprise Guide and the college paid for it.&amp;nbsp; My school did not renew the Enterprise Guide license.&amp;nbsp; I am now using SAS OnDemand for Academics and it is different than SAS Enterprise Guide.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to merge multiple variables (questions) to create a single variable that defines an independent variable or dependent variable so that I can do a linear regression to match my empirical model.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Path D (H1):&amp;nbsp; Y1 = a + b_1X1&amp;nbsp; + b_2X2 + b_3X3&amp;nbsp; + &lt;I&gt;e&amp;nbsp;&amp;nbsp;&lt;/I&gt;Note: the number following a Y or X is subscript.&amp;nbsp; Y is the dependent variable and Xs are independent variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My dataset has 120 variables (questions).&amp;nbsp; Q1 is the participant's ID number.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Y1 = questions 35-40&lt;/P&gt;&lt;P&gt;X1 = questions 22 - 29&lt;/P&gt;&lt;P&gt;X2 = questions 30-34 and 15 -17&lt;/P&gt;&lt;P&gt;X3 = questions 112 - 118&lt;/P&gt;&lt;P&gt;X4 = six to eight questions pulled from the data base that are not already being used.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In short, I am trying to merge 6 or more columns to recreate&amp;nbsp; new columns (121, 122,&amp;nbsp; 123, etc.) and use the new columns to test my hypothe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp; Lance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jun 2024 15:35:52 GMT</pubDate>
    <dc:creator>lwhoffman</dc:creator>
    <dc:date>2024-06-05T15:35:52Z</dc:date>
    <item>
      <title>How do I merge multiple variables to create multiple new variables in a data set?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-do-I-merge-multiple-variables-to-create-multiple-new/m-p/930959#M11284</link>
      <description>&lt;P&gt;I am working on my dissertation.&amp;nbsp; I am tryinjg to test my hypotheses.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the program course work, we were taught to use SAS Enterprise Guide and the college paid for it.&amp;nbsp; My school did not renew the Enterprise Guide license.&amp;nbsp; I am now using SAS OnDemand for Academics and it is different than SAS Enterprise Guide.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to merge multiple variables (questions) to create a single variable that defines an independent variable or dependent variable so that I can do a linear regression to match my empirical model.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example -&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Path D (H1):&amp;nbsp; Y1 = a + b_1X1&amp;nbsp; + b_2X2 + b_3X3&amp;nbsp; + &lt;I&gt;e&amp;nbsp;&amp;nbsp;&lt;/I&gt;Note: the number following a Y or X is subscript.&amp;nbsp; Y is the dependent variable and Xs are independent variables.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My dataset has 120 variables (questions).&amp;nbsp; Q1 is the participant's ID number.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Y1 = questions 35-40&lt;/P&gt;&lt;P&gt;X1 = questions 22 - 29&lt;/P&gt;&lt;P&gt;X2 = questions 30-34 and 15 -17&lt;/P&gt;&lt;P&gt;X3 = questions 112 - 118&lt;/P&gt;&lt;P&gt;X4 = six to eight questions pulled from the data base that are not already being used.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In short, I am trying to merge 6 or more columns to recreate&amp;nbsp; new columns (121, 122,&amp;nbsp; 123, etc.) and use the new columns to test my hypothe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&amp;nbsp; Lance&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 15:35:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-do-I-merge-multiple-variables-to-create-multiple-new/m-p/930959#M11284</guid>
      <dc:creator>lwhoffman</dc:creator>
      <dc:date>2024-06-05T15:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: How do I merge multiple variables to create multiple new variables in a data set?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-do-I-merge-multiple-variables-to-create-multiple-new/m-p/930968#M11285</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;In short, I am trying to merge 6 or more columns to recreate&amp;nbsp; new columns (121, 122,&amp;nbsp; 123, etc.)&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Be specific. What would this merge do? What is the input? What is the output? How do we get column 121? How do we get column 122? etc. (I'm not asking for code, I'm asking you to show us 2 or 3 examples)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 16:00:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-do-I-merge-multiple-variables-to-create-multiple-new/m-p/930968#M11285</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-06-05T16:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: How do I merge multiple variables to create multiple new variables in a data set?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-do-I-merge-multiple-variables-to-create-multiple-new/m-p/930969#M11286</link>
      <description>&lt;P&gt;I think that first you will have to provide an example of data to clarify just what these mean:&lt;/P&gt;
&lt;P&gt;Y1 = questions 35-40&lt;/P&gt;
&lt;P&gt;X1 = questions 22 - 29&lt;/P&gt;
&lt;P&gt;X2 = questions 30-34 and 15 -17&lt;/P&gt;
&lt;P&gt;X3 = questions 112 - 118&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am moderately sure that Y1 is not question 35 subtracting question 40. So you need to provide some guidelines as to how what appears to be 6 different questions get turned into values for Y1. As in examples of the data in the 6 questions and what the resulting Y1 for those values would be. And is Y1 supposed to be character or numeric at the end?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jun 2024 15:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-do-I-merge-multiple-variables-to-create-multiple-new/m-p/930969#M11286</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-06-05T15:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I merge multiple variables to create multiple new variables in a data set?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-do-I-merge-multiple-variables-to-create-multiple-new/m-p/931074#M11287</link>
      <description>&lt;P&gt;Example&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the 2021 National Financial Capabilities Study&lt;/P&gt;&lt;P&gt;&amp;nbsp;Y2 is Financial Wellbeing.&amp;nbsp; I define financial well-being using thequestions below.&amp;nbsp; Responses 98 and 99 are I don't know &amp;amp; I prefer not to say.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;Q34 &lt;/FONT&gt;&lt;/STRONG&gt;- How confident are you that you could come up with $2000 if an unexpected need arose with the next month?&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#0000FF"&gt;Responses:&amp;nbsp;1 - I am certain I could come up with the full $2000 to 4 - I am certain I could not come up with the $2000.&amp;nbsp; 98 &amp;amp; 99&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Q48 thru Q52 - How well do these statements describe your situation?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Q48&lt;/STRONG&gt; - I feel like I will never have the things I want in life.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#0000FF"&gt;&amp;nbsp;Responses:&amp;nbsp;1 - Does not describe me at all; 2 - Describes me very little; 3 - describes me somewhat; 4 - describes me very well; 5 - describes me completely; 98 &amp;amp; 99&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Q49&lt;/STRONG&gt; - I am just getting by financially.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#0000FF"&gt;&amp;nbsp;Responses:&amp;nbsp;1 - Does not describe me at all; 2 - Describes me very little; 3 - describes me somewhat; 4 - describes me very well; 5 - describes me completely; 98 &amp;amp; 99&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Q50&lt;/STRONG&gt; - I am concerned that the money I have or will save won't last.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Responses:&amp;nbsp;1 - Does not describe me at all; 2 - Describes me very little; 3 - describes me somewhat; 4 - describes me very well; 5 - describes me completely; 98 &amp;amp; 99&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Q51&lt;/STRONG&gt; -&amp;nbsp; How oftend do these statements apply to you? I have money left over at the end of the month.&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Responses: 1 Never; 2 Rarely; 3 Sometimes; 4 Often; 5 Always; 98 &amp;amp; 99&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Q52&lt;/STRONG&gt; - How oftend do these statements apply to you? My finances control my life.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;FONT color="#0000FF"&gt;Responses: 1 Never; 2 Rarely; 3 Sometimes; 4 Often; 5 Always; 98 &amp;amp; 99&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;In SAS Enterprise, I was able to create the variable "Well-being" by identifying the data variable responses (I have labled the columns using the question number in the code book).&amp;nbsp; The database is coded to provide a numeric value for each excluding responses 98 &amp;amp; 99.&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;I put the question to GPChat and it suggested using catx.&amp;nbsp; Programming looks like this:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;/* Using CATX function */&lt;BR /&gt;data new_dataset;&lt;BR /&gt;set existing_dataset;&lt;BR /&gt;new_variable = catx(' ', var1, var2, var3); /* Space delimiter, trims spaces */&lt;BR /&gt;run;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Does this look right?&amp;nbsp; If i am reading this correctly, the new category or label would be "Wellbeing" with an over all score of the numeric values for each respondent.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000FF"&gt;Thank you for responding.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 00:25:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-do-I-merge-multiple-variables-to-create-multiple-new/m-p/931074#M11287</guid>
      <dc:creator>lwhoffman</dc:creator>
      <dc:date>2024-06-06T00:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I merge multiple variables to create multiple new variables in a data set?</title>
      <link>https://communities.sas.com/t5/SAS-Studio/How-do-I-merge-multiple-variables-to-create-multiple-new/m-p/931094#M11288</link>
      <description>&lt;P&gt;We asked you to tell us how you would "merge 6 or more columns", you haven't told us. An answer in words, without code, would be helpful; I also asked for you to provide an example or two would also be helpful, without code. Instead,&amp;nbsp; you told us how ChatGPT would do something. Is that what you want for your hypothesis test, some character string from ChatGPT code that contains several responses with spaces in between?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And then once you have this new variable from "merge", what will you do with it? Once you have this new variable from "merge", how will it be used to test an hypothesis? What hypothesis? You haven't told us that either.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2024 11:05:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/How-do-I-merge-multiple-variables-to-create-multiple-new/m-p/931094#M11288</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-06-06T11:05:11Z</dc:date>
    </item>
  </channel>
</rss>

