Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7418117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:49:33+00:00 2026-05-29T07:49:33+00:00

Below is some data: Test Day1 Day2 Score A 1 2 100 B 1

  • 0

Below is some data:

    Test Day1 Day2 Score
    A 1 2 100
    B 1 3 62
    C 3 4 90
    D 2 4 20
    E 4 5 80

I am trying to take the values from column ‘day’ and ‘day2’ and use them to select the row number for the column score. For example for Test A I would like to find the sum of 100 and 62 because that is the values of the first and second rows of score. Test B I would like to find the sum of 100, 62 and 90.
Does anyone have any ideas on how to go about doing this? I am looking to use something similar to the indirect function in Excel? Thank You

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:49:34+00:00Added an answer on May 29, 2026 at 7:49 am

    The trick is to convert variable “Score” as a row. Could not think of an easy way how to avoid SAVE/GET – room for improvements.

    file handle tmp
     /name = "C:\DATA\Temp".
    
    ***.
    
    data list free /Test (a1) Day1 (f8) Day2 (f8) Score (f8).
    begin data
    A 1 2 100
    B 1 3 62
    C 3 4 90
    D 2 4 20
    E 4 5 80
    end data.
    
    comp f = 1.
    
    var wid all (12).
    
    save out "tmp\data.sav".
    
    
    ***.
    
    get "tmp\data.sav"
     /keep score.
    
    flip.
    
    comp f = 1.
    
    match files
     /file "tmp\data.sav"
     /table *
     /by f
     /drop case_lbl.
    
    comp stat = 0.
    do rep var = var001 to var005
     /k = 1 to 5.
    if range(k, Day1, Day2) stat = sum(stat, var).
    end rep.
    
    list Test Day1 Day2 Score stat. 
    

    The result:

    Test     Day1     Day2    Score     stat
    
    A           1        2      100      162
    B           1        3       62      252
    C           3        4       90      110
    D           2        4       20      172
    E           4        5       80      100
    
    
    Number of cases read:  5    Number of cases listed:  5
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is some data: Test Day1 Day2 Score A 1 2 100 B 1
I'm having some problems trying to get the code below to output the data
I'm trying to insert some data into SQL from Excel VBA. The SQL commands
Im trying to append some JSON data from the last.fm API, I have been
Im trying to append some JSON data from the last.fm API, I have been
I am trying to perform a multivariate test for normality on some density data
I am trying to get some data back from a server using jQuery $.getJSON
I have the below markup that cannot be changed: <div>Some data</div> <span>More data</span> <a>Link
When I use a conditional statement targeting IE6 and below with some PHP code
I have data in data table like below. I am trying to make graph

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.