something like the following will do what you are asking to do (you will need to retype it making sure there is at least one space before the !do, !doend and !concat and eliminating any 'strange' characters that the email might be introducing in the text).
* start.
define !doit().
new file.
input program.
loop case = 1 to 10.
end case.
end loop.
end file.
end input program.
execute.
numeric
!do !y = 2012 !to 2021
!do !m = 1 !to 12
!do !v !in("REC CALL HOUR")
!do !s !in("GrCoun LeAdv EcoA Etc")
!concat("Y",!y,"_",!m,"_",!v,"_",!s)
!doend
!doend
!doend
!doend.
execute.
!enddefine.
!doit.
* end.
but, i agree with jon, for data entry and manipulation you might be better off having a long file with the variables year, month, service, type and value, and then you can transpose this data as needed for pairwise comparisons.
------------------------------
Eugenio Gonzalez
------------------------------
Original Message:
Sent: Tue June 21, 2022 02:22 PM
From: Shannon Harper
Subject: Help! Completely lost as to syntax commands!
Hello Everyone - I am struggling to compile my large dataset and am assuming syntax commands or vectors are the answer, although I am very new to both. My questions are specific to what syntax commands (or other methods) I should use to create hundreds/thousands of new variable names so I do not need to do it manually. Creating the variable names will allow me to input the nominal/numerical data easily. Explained below.
I am working with a dataset involving intimate partner homicides and domestic violence services utilization among victims from 2012-2021 (10 years), involving monthly data (120 months total). Across that timeframe, I have a three variable set: 1. REC [number of clients who received services]; 2. CALL [number of calls for services]; and 3. HOUR [number of hours advocates/employees spent providing services]) that needs to be repeated monthly Jan-Dec across 10 years 2012-2021 and 39 separate services. See below:
MonthYear_REC_ServiceName
MonthYear_CALL_ServiceName
MonthYear_HOUR_ServiceName
"Month" in the above is Jan-Dec (01-12), "Year" is 2012-2021 (12-21), and "ServiceName" would be replaced with 39 different services. As an example for the year 2017 and "Shelter" services:
0117_REC_Shelter
0117_CALL_Shelter
0117_HOUR_Shelter
0217_REC_Shelter
0217_CALL_Shelter
0217_HOUR_Shelter
0317_REC_Shelter
0317_CALL_Shelter
0317_HOUR_Shelter .....so on and so forth until December of 2017. So new variable names need created using syntax or whatever else works (???). I would then need to modify the syntax to create similar variable names for Group Counseling, Legal Advocacy, Economic Assistance, etc. (e.g., 0117_REC_GrpCouns; 0117_CALL_GrpCouns; 0117_HOUR_GrpCouns, so on and so forth until December).
To further explain: This sequential monthly order would need to be repeated for each year AND each month in the 2012-2021 timeframe for each of 39 domestic violence services for which I have data (three variables per month - REC, CALL, HOUR across 10 years and 120 months x 39 services).
My overall question is (sorry for the repetition)- What syntax commands would I need to input that I could modify to create this MASSIVE amount of new variable names? I am completely lost as to methods. I hope this makes sense to everyone in the same way it makes sense in my head. Sorry for the length of the discussion and thank you in advance.
With gratitude.
Shannon Harper, Ph.D.
------------------------------
Shannon Harper
------------------------------
#SPSSStatistics