### Aptech Systems, Inc. Worldwide Headquarters

Address:

Aptech Systems, Inc.

2350 East Germann Road, Suite #21

Chandler, AZ 85286Phone: 360.886.7100

FAX: 360.886.8922**Ready to Get Started?**### Request Quote & Product Information

### Industry Solutions

### Products

### Resources

### Support

### Training & Events

Want more guidance while learning about the full functionality of GAUSS and its capabilities? Get in touch for in-person training or browse additional references below.

### Tutorials

Step-by-step, informative lessons for those who want to dive into GAUSS and achieve their goals, fast.

### Have a Specific Question?

### Q&A: Register and Login

### Support Plans

Premier Support and Platinum Premier Support are annually renewable membership programs that provide you with important benefits including technical support, product maintenance, and substantial cost-saving features for your GAUSS System or the GAUSS Engine.

### User Forums

Join our community to see why our users are considered some of the most active and helpful in the industry!

### Where to Buy

Available across the globe, you can have access to GAUSS no matter where you are.

### Recent Tags

applications character vectors CML CMLMT Constrained Optimization datasets dates dlibrary dllcall econometrics Editor error error codes errors Excel file i/o floating network GAUSS Engine GAUSS Light graphics GUI hotkeys installation license licensing linux loading data loop loops matrix manipulation Maximum Likelihood Maxlik MaxLikMT Memory multidimensional array optimization Optmum output panel data PQG graphics procs random numbers strings structures threading### Recent Questions

- How to identify the break date for Hatemi-J cointegration test
- error G0152 : Variable not initialized stack trace:
- 'selif' does not work for strings
- Some parts of the screen show very small fonts
- Integration over an interval
- CKLS 1992 Gauss Code with Structural Breaks?
- plotSetXRange is not working
- Gauss Mac Installation
- Can i get MaxLik Packge for Mac OS
- How to run Narayan and Popp (2010) unit root test with two structural break

### Features

### Time Series 2.0 MT

### Industry Solutions

### Find out more now

### Time Series MT 2.1

### Find out more now

### Find out more now

# Resources

# how can I combine the name part and data part??

The below is what you say. Then, how can I combine the name part and data part??

range = xlsMakeRange(1|1, 1|367); varnames = spreadSheetReadSA("myfile.xls", range, 1); mydata = spreadSheetReadM("myfile.xls", "B1", 1);

## 1 Answer

Usually you don't want to combine the name and data together in the matrix. GAUSS is a matrix language that is designed to easily write code that looks like the underlying mathematics.

Let's say that you have a simple model with `Income` as the dependent variable while `Age` and `Education` are the explanatory variables. This simple example will start with a 4x1 vector representing `Income` and a 4x2 matrix where the first column represents `Age` and the second column represents `Education`. We will also have a string array containing the names of the dependent variables.

//'y' contains income y = { 50, 75, 41, 63 }; //The first column of 'x' //is age, the second is education x = { 35 12, 59 7, 44 9, 47 16 }; //String array with variable names string varnames = { "Age", "Education" }; //Least squares estimation b_hat = y/x; //Print parameter values for i(1, rows(varnames), 1); print "The estimated parameter value for "$+varnames[i]; print "is equal to " b_hat[i]; endfor;

This code will produce the output:

The estimated parameter value for Age is equal to 1.0979158 The estimated parameter value for Education is equal to 0.61703551

In this simple program above, we do not need the variable names in `x` and `y`. The matrices contain only the data, which is what we need for calculations. Reporting our output in terms of the variable names is easy to do since we know they are at the same position in `varnames` that their corresponding data is in `x`.

## Your Answer

## 1 Answer

Usually you don't want to combine the name and data together in the matrix. GAUSS is a matrix language that is designed to easily write code that looks like the underlying mathematics.

Let's say that you have a simple model with `Income` as the dependent variable while `Age` and `Education` are the explanatory variables. This simple example will start with a 4x1 vector representing `Income` and a 4x2 matrix where the first column represents `Age` and the second column represents `Education`. We will also have a string array containing the names of the dependent variables.

//'y' contains income y = { 50, 75, 41, 63 }; //The first column of 'x' //is age, the second is education x = { 35 12, 59 7, 44 9, 47 16 }; //String array with variable names string varnames = { "Age", "Education" }; //Least squares estimation b_hat = y/x; //Print parameter values for i(1, rows(varnames), 1); print "The estimated parameter value for "$+varnames[i]; print "is equal to " b_hat[i]; endfor;

This code will produce the output:

The estimated parameter value for Age is equal to 1.0979158 The estimated parameter value for Education is equal to 0.61703551

In this simple program above, we do not need the variable names in `x` and `y`. The matrices contain only the data, which is what we need for calculations. Reporting our output in terms of the variable names is easy to do since we know they are at the same position in `varnames` that their corresponding data is in `x`.