Saving a list of variables in a file - spss

I'd like to automate the syntax. The number of variables varies from year to year. In one year the variable state occurs four times, in the next maybe six times.
I'd like to use something like WRITE OUTFILE to store a list containing the variable names and which I can call whenever needed.

Not sure how you can get a few variables called "state" in the same dataset?
In any case, if you want a list of the variables in your data saved as a new file, you can do this:
dataset declare ListOfVars.
oms /select tables /if commands=['File Information'] subtypes=['Variable Information']
/destination format=sav outfile='ListOfVars' .
display dictionary.
omsend.
dataset activate ListOfVars.
The new dataset ListOfVars has the list of your variables and their labels (and some other data).
Now just save the table to a new fine and keep whatever variables you need from it.

Related

Separate date and value from influxdb

hello I would like to know if it is possible to select only the values of my influx table, when I make a query in python it also extracts the date. or I would like to know how I can separate them within python to later create a dataframe.
this is what i have in my table.
name: va1
time value
1638023512567678902 1655.6
1638023518355667369 1655.6
1638023524074845230 1655.6
1638023529782981342 1655.6
i need to extract the values separately

How to get current variable from excel into SPSS

I'm new in the SPSS and I need some help.I have a Excel file with many columns and I have to write syntax to get only the variables which I need (for example id name). The name of the variables are at first row.
First import your excel file (use the open data menu and paste the syntax).
then use this:
add files /file=* /keep= var1 var2 var3.
This will let you keep only the variables you need and in the preferred order.
if some of these variables are ordered consecutively in the file you can use "someVar TO someotherVar" in the keep subcommand.

Multiple response crosstabs/frequencies based on categorical variable in SPSS

I've just started using SPSS after using R for about five years (I'm not happy about it, but you do what your boss tells you). I'm just trying to do a simple count based on a categorical variable.
I have a data set where I know a person's year of birth. I've recoded into a new variable so that I have their generation as a categorical variable, named Generation. I also have a question that allows for multiple responses. I want a frequency of how many times each response was collected.
I've created a multiple response variable (analyze>multiple response > Define variable sets). However, when I go to create crosstabs, the Generation variable isn't an option to select. I've tried googling, but the videos I have watched have the row variables as numeric.
Here is a google sheet that shows what I have and what I'm looking to achieve:
https://docs.google.com/spreadsheets/d/1oIMrhYv33ZQwPz3llX9mfxulsxsnZF9zaRf9Gh37tj8/edit#gid=0
Is it possible to do this?
First of all, to double check, when you say you go to crosstabs, is this Analyze > Multiple Response > Crosstabs (and not Analyze > Descriptive Statistics > Crosstabs)?
Second, with multiple response data, you are much better off working with Custom Tables. Start by defining the set with Analyze > Custom Tables > Multiple Response Sets. If you save your data file, those definitions are saved with it (unlike the Mult Response Procedure).
Then you can just use Custom Tables to tabulate mult response data pretty much as if it were a regular variable, but you have more choices about appropriate statistics, tests of significance etc. No need in the CTABLES code to explicitly list the set members.
Try CUSTOM TABLES, although this is an additional add-on modules that you need to have a licence for:
CTABLES /TABLE Generation[c] by (1_a+ 1_b + 1_c)[s][sum f8.0 'Count'].

Delphi Combo Edit from CSV File

I have an application that will load a CSV file containing two columns. At program load I need to have the first column as items in a combo edit control. Once the user selects (or enters a value) I need to populate a label with the value from the second column. My thought was to use an in memory data set, FDMemTable which would be loaded at form create. Then once the user selects, or enters an item, I would run a query to pull the description. I've tried but have been unsuccessful with the simple loading of the combo edit.
Is this the best way to achieve the desired results, and is there samples similar to what I'm looking to do?
Read the file.
Parse it into an array of name/value pairs.
Populate the combo drop down list with the names.
When the combo's selection is changed to a new index, read the value from the array using that index. Update the label.
Database tables and queries seem somewhat over the top for a single simple task like this.

How do I use Macros to copy select data from one worksheet to another on Excel?

I need to create a Macro on Excel to keep track of changing contracts. There's already an existing macro that updates the contract data so I need to create another macro...
There are two worksheets. On the first worksheet is a bunch of data with each row representing one contract. There are several categories (Contract #, Date, Price, etc.).
I need to write a Macro that finds only certain contracts fitting specific criteria (like, contacts at a specific date or a certain price), copies and pastes them into the second worksheet.
What I've done so far:
I've figured out a bit of a convoluted way of doing it using IF and OR functions. So using OR I specify the criteria and IF to basically find the corresponding data if things are TRUE.
When things are false, a 0 is entered. The problem is I have tons of rows of zeroes---rows/contracts that didn't fit the criteria. When I try to use the find command (CTRL+F) to find, highlight, and properly delete (with rows shifted up) all the zeroes, Macro doesn't record it and I'm not sure how to write it in the code.
Any insight would help!
Just change your formula to:
=IF(OR(TermSheet!$E40=41220,TermSheet!$M40="bpxx"),TermSheet!E40,"")

Resources