BookmarkSubscribeRSS Feed
lwhoffman
Calcite | Level 5

I am working on my dissertation.  I am tryinjg to test my hypotheses. 

 

In the program course work, we were taught to use SAS Enterprise Guide and the college paid for it.  My school did not renew the Enterprise Guide license.  I am now using SAS OnDemand for Academics and it is different than SAS Enterprise Guide. 

 

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. 

For example - 

  Path D (H1):  Y1 = a + b_1X1  + b_2X2 + b_3X3  + e  Note: the number following a Y or X is subscript.  Y is the dependent variable and Xs are independent variables. 

My dataset has 120 variables (questions).  Q1 is the participant's ID number. 

Y1 = questions 35-40

X1 = questions 22 - 29

X2 = questions 30-34 and 15 -17

X3 = questions 112 - 118

X4 = six to eight questions pulled from the data base that are not already being used. 

 

In short, I am trying to merge 6 or more columns to recreate  new columns (121, 122,  123, etc.) and use the new columns to test my hypothe

 

Thanks.  Lance

 

 

4 REPLIES 4
PaigeMiller
Diamond | Level 26

In short, I am trying to merge 6 or more columns to recreate  new columns (121, 122,  123, etc.)


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)

--
Paige Miller
lwhoffman
Calcite | Level 5

Example 

I am using the 2021 National Financial Capabilities Study

 Y2 is Financial Wellbeing.  I define financial well-being using thequestions below.  Responses 98 and 99 are I don't know & I prefer not to say. 

 

Q34 - How confident are you that you could come up with $2000 if an unexpected need arose with the next month?

      Responses: 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.  98 & 99

            Q48 thru Q52 - How well do these statements describe your situation? 

Q48 - I feel like I will never have the things I want in life.

       Responses: 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 & 99

Q49 - I am just getting by financially.

       Responses: 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 & 99

Q50 - I am concerned that the money I have or will save won't last.

       Responses: 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 & 99

Q51 -  How oftend do these statements apply to you? I have money left over at the end of the month.

       Responses: 1 Never; 2 Rarely; 3 Sometimes; 4 Often; 5 Always; 98 & 99

Q52 - How oftend do these statements apply to you? My finances control my life. 

       Responses: 1 Never; 2 Rarely; 3 Sometimes; 4 Often; 5 Always; 98 & 99

 

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).  The database is coded to provide a numeric value for each excluding responses 98 & 99.  

 

I put the question to GPChat and it suggested using catx.  Programming looks like this:

/* Using CATX function */
data new_dataset;
set existing_dataset;
new_variable = catx(' ', var1, var2, var3); /* Space delimiter, trims spaces */
run;

Does this look right?  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. 

 

Thank you for responding. 

PaigeMiller
Diamond | Level 26

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,  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?

 

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.

--
Paige Miller
ballardw
Super User

I think that first you will have to provide an example of data to clarify just what these mean:

Y1 = questions 35-40

X1 = questions 22 - 29

X2 = questions 30-34 and 15 -17

X3 = questions 112 - 118

 

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?

 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 628 views
  • 0 likes
  • 3 in conversation