Stata code

We’ve had some issues with string variables versus float and int variables in class. In order to destring a variable, use the following command:

destring variablename, replace

A variable will not restring unless there are no non-numeric characters, so you may have to replace some of the values that are coded as “—” in the NIPA tables. You can do this by manually typing “.” (for missing) into the data editor or using the replace command. Generally, the syntax for such things looks like this:

replace variablename=”.” if variablename==”—”

However, it doesn’t appear to be reading the “—” in the files. If you find another way besides manually entering each missing value, please let everyone know by commenting here.

In addition, the variance-covariance matrix can be obtained using the corr command. Type:

corr variablename1 variablename2, covariance

For significance level associated with correlations, use:

pwcorr variablename1 variablename2, sig



Leave a comment

Filed under Issue in Class

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s