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 8147433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:20:59+00:00 2026-06-06T14:20:59+00:00

I have a range of weekly variables describing a person’s status (from week 1,

  • 0

I have a range of weekly variables describing a person’s “status” (from week 1, 2010 to 2012 week 17).

The variables are given by:

y_1001, y_1002,...y1052, y1101, y1102,......y_1217

I define the period of variables like this:

%let period = y_1001-1052 y_1101-y1148;

I also have a treatment period given as a start date and an end date. My challenge is to find the status given by the y_ variables in the week after the person stops the treatment.

I am not too familiar with SAS, but my idea was to “pick” the correct y_ variable based on a week counter, say by counting the number of weeks since the beginning of the period (week 1 in 2010) and until the date where the treatment ends.

I get the weeks until end of treatment like this

week_count = 1 + intck( 'week.2', '1JAN2010'd, end_treatment_date, 'd');

But how can I retrieve the corresponding y_ variable based on this count?

After fruitless search on how to loop over the period variables and pick the number corresponding to the week_count variable for each person, I thought about going a different way… say something like this.

array weeks(*) .
do i = 1 to dim(weeks) by 1;
  if week_count = i then end_status = y_10&i;
end

…but with modifications to take into account that there is a mismatch between the dimension of the array and the number of weeks and years.

But then my challenge is to make the following part work…

if week_count = i then end_status = y_10&i;

How can I make SAS pick the right y_ variable based on the loop index? This seems like a really simple problem, but somehow I have not managed to find a solution. Is there no way to use the variable “i” as input in defining the correct y_ variable?

Would really appreciate if somebody could throw some hints.

  • 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-06-06T14:21:00+00:00Added an answer on June 6, 2026 at 2:21 pm

    I think you want:

    if week_count = i then end_status = weeks{i};
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a range of weekly dates like example 1-5-2010 to 7-5-2010 i want
I have range of numbers that range from 1 - 0.00000X . Most are
Suppose I have range from E2 to E16. How do I read values from
I have a range of cells the I retrieve from excel and I want
Say I have a range of data from A1:Y55 containg data like 123 UID
Let me start with an example - I have a range of numbers from
I have datetime range: var _checkInYear = (from d in db.bookings select d.checkinyear).ToList(); var
I have a range slider and I want it to display values from a
I have a range of values ( L,R,U,D ) and two variables, d and
Suppose I have a range given below 400001 - 400104 400601 - 400614 400701

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.