counting semesters

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

counting semesters

wsu_wright
I need to calculate the number of semesters from first to last course
based on our academic term code.  The term code is a 5 digit numeric
where the 1st 4 digits are the calendar year and the last digit is the
semester (3=fall, 2=summer, 1=spring) as in 20083 (fall 2008) or 20061
(spring 2006).

We do not count summer semesters, so for these data, summer terms have
been recoded into fall or spring terms (if the student started in summer
the term code is changed to reflect fall (2=3), if they end in summer,
the term code is changed to reflect spring (2=1)).

Listed below is an example of the data:

ID term1st termlast
1  20041  20091
2  20061  20083
3  20053  20091
4  20043  20063

So we should have for ID #1=11 semesters, #2=6, #3=8 and #4=5.

I've struggled with different syntax but cannot get a consistent count
across all possible semester types (Fall-Fall,F-S,S-S,S-F) so thought I
would throw this to the list.

Thanks in advance,

David

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: counting semesters

John F Hall

You can check the data by:
 
compute year1st =  trunc (term1st/10)
compute sem1st = term1st - year1st .
compute yearlast =  trunc (termlast/10)
compute semlast = termlast - yearlast .
cros yearlast by semlast.
 
Someone is bound to give you some cdoe to calculate the number of semesters, but you can always use a set of
 
DO IF...END IF
 
working from the the table or a combination of recode and compute, but my dinner's on the table.
----- Original Message -----
Sent: Sunday, September 12, 2010 7:14 PM
Subject: counting semesters


I need to calculate the number of semesters from first to last course
based on our academic term code.  The term code is a 5 digit numeric
where the 1st 4 digits are the calendar year and the last digit is the
semester (3=fall, 2=summer, 1=spring) as in 20083 (fall 2008) or 20061
(spring 2006).

We do not count summer semesters, so for these data, summer terms have
been recoded into fall or spring terms (if the student started in summer
the term code is changed to reflect fall (2=3), if they end in summer,
the term code is changed to reflect spring (2=1)).

Listed below is an example of the data:

ID term1st termlast
1  20041  20091
2  20061  20083
3  20053  20091
4  20043  20063

So we should have for ID #1=11 semesters, #2=6, #3=8 and #4=5.

I've struggled with different syntax but cannot get a consistent count
across all possible semester types (Fall-Fall,F-S,S-S,S-F) so thought I
would throw this to the list.

Thanks in advance,

David

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

Reply | Threaded
Open this post in threaded view
|

Re: counting semesters (2)

John F Hall
In reply to this post by wsu_wright

Ignore my previous reply.
 
This syntax does part of what you want (tested) but I need to think about how to count the semesters.
 
data list free
 /ID term1st termlast .
begin data
1  20041  20091
2  20061  20083
3  20053  20091
4  20043  20063
end data .
 
compute year1st =  trunc (term1st/10) .
compute sem1st = term1st - year1st*10 .
compute yearlast =  trunc (termlast/10) .
compute semlast = termlast - yearlast*10 .
freq year1st to semlast .
----- Original Message -----
Sent: Sunday, September 12, 2010 7:14 PM
Subject: counting semesters


I need to calculate the number of semesters from first to last course
based on our academic term code.  The term code is a 5 digit numeric
where the 1st 4 digits are the calendar year and the last digit is the
semester (3=fall, 2=summer, 1=spring) as in 20083 (fall 2008) or 20061
(spring 2006).

We do not count summer semesters, so for these data, summer terms have
been recoded into fall or spring terms (if the student started in summer
the term code is changed to reflect fall (2=3), if they end in summer,
the term code is changed to reflect spring (2=1)).

Listed below is an example of the data:

ID term1st termlast
1  20041  20091
2  20061  20083
3  20053  20091
4  20043  20063

So we should have for ID #1=11 semesters, #2=6, #3=8 and #4=5.

I've struggled with different syntax but cannot get a consistent count
across all possible semester types (Fall-Fall,F-S,S-S,S-F) so thought I
would throw this to the list.

Thanks in advance,

David

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

Reply | Threaded
Open this post in threaded view
|

Re: counting semesters

edunbar
In reply to this post by John F Hall
the term 'gradual school' comes to mind (sorry!)

ed dunbar


Quoting John F Hall <[hidden email]>:

> You can check the data by:
>
> compute year1st =  trunc (term1st/10)
> compute sem1st = term1st - year1st .
> compute yearlast =  trunc (termlast/10)
> compute semlast = termlast - yearlast .
> cros yearlast by semlast.
>
> Someone is bound to give you some cdoe to calculate the number of
> semesters, but you can always use a set of
>
> DO IF...END IF
>
> working from the the table or a combination of recode and compute,
> but my dinner's on the table.
>   ----- Original Message -----
>   From: David Wright
>   To: [hidden email]
>   Sent: Sunday, September 12, 2010 7:14 PM
>   Subject: counting semesters
>
>
>
>   I need to calculate the number of semesters from first to last course
>   based on our academic term code.  The term code is a 5 digit numeric
>   where the 1st 4 digits are the calendar year and the last digit is the
>   semester (3=fall, 2=summer, 1=spring) as in 20083 (fall 2008) or 20061
>   (spring 2006).
>
>   We do not count summer semesters, so for these data, summer terms have
>   been recoded into fall or spring terms (if the student started in summer
>   the term code is changed to reflect fall (2=3), if they end in summer,
>   the term code is changed to reflect spring (2=1)).
>
>   Listed below is an example of the data:
>
>   ID term1st termlast
>   1  20041  20091
>   2  20061  20083
>   3  20053  20091
>   4  20043  20063
>
>   So we should have for ID #1=11 semesters, #2=6, #3=8 and #4=5.
>
>   I've struggled with different syntax but cannot get a consistent count
>   across all possible semester types (Fall-Fall,F-S,S-S,S-F) so thought I
>   would throw this to the list.
>
>   Thanks in advance,
>
>   David
>
>   =====================
>   To manage your subscription to SPSSX-L, send a message to
>   [hidden email] (not to SPSSX-L), with no body text except the
>   command. To leave the list, send the command
>   SIGNOFF SPSSX-L
>   For a list of commands to manage subscriptions, send the command
>   INFO REFCARD
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: counting semesters (2)

Bruce Weaver
Administrator
In reply to this post by John F Hall
In his earlier post, John suggested a DO IF - END IF structure.  Here's one way to do that.  I've changed some of John's variable names, and made them scratch variables so they don't clutter up the data file.

compute #y1 =  trunc (term1st/10) .
compute #sem1 = term1st - #y1*10 .
if (#sem1 EQ 2) #sem1 = 3.
compute #y2 =  trunc (termlast/10) .
compute #sem2 = termlast - #y2*10 .
if (#sem2 EQ 2) #sem2 = 1.

compute semesters = (#y2 - #y1) * 2 + 1.
* Now adjust semester count if necessary.
do if (#sem1 LT #sem2).
- compute semesters = semesters + 1.
else if (#sem1 GT #sem2).
- compute semesters = semesters - 1.
end if.

list.

OUTPUT:

      ID  term1st termlast semesters

       1    20041    20091        11
       2    20061    20083         6
       3    20053    20091         8
       4    20043    20063         5



John F Hall wrote
Ignore my previous reply.

This syntax does part of what you want (tested) but I need to think about how to count the semesters.

data list free
 /ID term1st termlast .
begin data
1  20041  20091
2  20061  20083
3  20053  20091
4  20043  20063
end data .

compute year1st =  trunc (term1st/10) .
compute sem1st = term1st - year1st*10 .
compute yearlast =  trunc (termlast/10) .
compute semlast = termlast - yearlast*10 .
freq year1st to semlast .
  ----- Original Message -----
  From: David Wright
  To: SPSSX-L@LISTSERV.UGA.EDU
  Sent: Sunday, September 12, 2010 7:14 PM
  Subject: counting semesters



  I need to calculate the number of semesters from first to last course
  based on our academic term code.  The term code is a 5 digit numeric
  where the 1st 4 digits are the calendar year and the last digit is the
  semester (3=fall, 2=summer, 1=spring) as in 20083 (fall 2008) or 20061
  (spring 2006).

  We do not count summer semesters, so for these data, summer terms have
  been recoded into fall or spring terms (if the student started in summer
  the term code is changed to reflect fall (2=3), if they end in summer,
  the term code is changed to reflect spring (2=1)).

  Listed below is an example of the data:

  ID term1st termlast
  1  20041  20091
  2  20061  20083
  3  20053  20091
  4  20043  20063

  So we should have for ID #1=11 semesters, #2=6, #3=8 and #4=5.

  I've struggled with different syntax but cannot get a consistent count
  across all possible semester types (Fall-Fall,F-S,S-S,S-F) so thought I
  would throw this to the list.

  Thanks in advance,

  David

  =====================
  To manage your subscription to SPSSX-L, send a message to
  LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
  command. To leave the list, send the command
  SIGNOFF SPSSX-L
  For a list of commands to manage subscriptions, send the command
  INFO REFCARD
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Automatic reply: counting semesters (2)

Mike Speed

I am out of the office until 9/17/2010

Reply | Threaded
Open this post in threaded view
|

Re: counting semesters (2)

wsu_wright
In reply to this post by John F Hall
Bruce & John,

Thanks for the help.  I had a similar configuration but as a series of
IF statements but yours is more parsimonious, & the scratch variables do
help avoid the clutter, thanks again fellows.

David


On Sun, Sep 12, 2010 at 2:48 PM, Bruce Weaver wrote:

> In his earlier post, John suggested a DO IF - END IF structure.
> Here's one
> way to do that.  I've changed some of John's variable names, and made
> them
> scratch variables so they don't clutter up the data file.
>
> compute #y1 =  trunc (term1st/10) .
> compute #sem1 = term1st - #y1*10 .
> if (#sem1 EQ 2) #sem1 = 3.
> compute #y2 =  trunc (termlast/10) .
> compute #sem2 = termlast - #y2*10 .
> if (#sem2 EQ 2) #sem2 = 1.
>
> compute semesters = (#y2 - #y1) * 2 + 1.
> * Now adjust semester count if necessary.
> do if (#sem1 LT #sem2).
> - compute semesters = semesters + 1.
> else if (#sem1 GT #sem2).
> - compute semesters = semesters - 1.
> end if.
>
> list.
>
> OUTPUT:
>
>       ID  term1st termlast semesters
>
>        1    20041    20091        11
>        2    20061    20083         6
>        3    20053    20091         8
>        4    20043    20063         5
>
>
>
>
> John F Hall wrote:
>>
>> Ignore my previous reply.
>>
>> This syntax does part of what you want (tested) but I need to think
>> about
>> how to count the semesters.
>>
>> data list free
>>  /ID term1st termlast .
>> begin data
>> 1  20041  20091
>> 2  20061  20083
>> 3  20053  20091
>> 4  20043  20063
>> end data .
>>
>> compute year1st =  trunc (term1st/10) .
>> compute sem1st = term1st - year1st*10 .
>> compute yearlast =  trunc (termlast/10) .
>> compute semlast = termlast - yearlast*10 .
>> freq year1st to semlast .
>>   ----- Original Message -----
>>   From: David Wright
>>   To: [hidden email]
>>   Sent: Sunday, September 12, 2010 7:14 PM
>>   Subject: counting semesters
>>
>>
>>
>>   I need to calculate the number of semesters from first to last
>> course
>>   based on our academic term code.  The term code is a 5 digit
>> numeric
>>   where the 1st 4 digits are the calendar year and the last digit is
>> the
>>   semester (3=fall, 2=summer, 1=spring) as in 20083 (fall 2008) or
>> 20061
>>   (spring 2006).
>>
>>   We do not count summer semesters, so for these data, summer terms
>> have
>>   been recoded into fall or spring terms (if the student started in
>> summer
>>   the term code is changed to reflect fall (2=3), if they end in
>> summer,
>>   the term code is changed to reflect spring (2=1)).
>>
>>   Listed below is an example of the data:
>>
>>   ID term1st termlast
>>   1  20041  20091
>>   2  20061  20083
>>   3  20053  20091
>>   4  20043  20063
>>
>>   So we should have for ID #1=11 semesters, #2=6, #3=8 and #4=5.
>>
>>   I've struggled with different syntax but cannot get a consistent
>> count
>>   across all possible semester types (Fall-Fall,F-S,S-S,S-F) so
>> thought I
>>   would throw this to the list.
>>
>>   Thanks in advance,
>>
>>   David
>>
>>   =====================
>>   To manage your subscription to SPSSX-L, send a message to
>>   [hidden email] (not to SPSSX-L), with no body text
>> except the
>>   command. To leave the list, send the command
>>   SIGNOFF SPSSX-L
>>   For a list of commands to manage subscriptions, send the command
>>   INFO REFCARD
>>
>>
>>
>
>
> -----
> --
> Bruce Weaver
> [hidden email]
> http://sites.google.com/a/lakeheadu.ca/bweaver/
>
> "When all else fails, RTFM."
>
> NOTE: My Hotmail account is not monitored regularly.
> To send me an e-mail, please use the address shown above.
>
> --
> View this message in context:
> http://spssx-discussion.1045642.n5.nabble.com/counting-semesters-tp2836907p2837021.html
> Sent from the SPSSX Discussion mailing list archive at Nabble.com.
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except
> the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD