National Language Shift Table And Concatenated Sms - sms

Can we combine User Data Header for National Language Locking Shift Table and Concatenated SMS?
Concatenated Sms Header:
00 IEI for concatenated sms
03 Information element data length
a1 A reference number
03 This message has 3 parts
01 This is part 1
How can I add language locking shift table header to this header.
Example of language shift table header:
03 length of udh
24 single shift table
01 Information element data length
02 language of shift table
Thank you.

Yes you can, you just need to create a UDH header that contains both the shift table and the concatenation header. So for your example above you need to have
08 - length of the whole UDH header (5 for concat + 3 for shift table)
00 - IEI for concatenation with 8 bit reference
03 - length of concat data
a1 - reference number
03 - 3 parts in total
01 - part 1
24 - IEI for single shift table ( if you want locking shift, use 25)
01 - length of shift table data
02 - spanish language
Jim

Related

How to group by multiple columns and then transpose in Hive

I have some data that I want to group by on multiple columns, perform an aggregation function on, and then transpose into different columns using Hive.
For example, given this input
Input:
hr type value
01 a 10
01 b 20
01 c 50
01 a 30
02 c 10
02 b 90
02 a 80
I want to produce this output:
Output:
hr a_avg b_avg c_avg
01 20 20 50
02 80 90 10
Where there is one distinct column for each distinct type in my input. a_avg corresponds to the average a value for each hour.
How can I do this in Hive? I am guessing I might need to make use of https://github.com/klout/brickhouse/wiki/Collect-UDFs
So far the best I can think of is to use multiple group-by clauses, but that won't transpose the data into multiple columns.
Any ideas?
You don't necessarily need to use Brickhouse, but it will definitely make it easier. Here is what I'm thinking, something like
select hr
, type_map['a'] a_avg
, type_map['b'] b_avg
, type_map['c'] c_avg
from (
select hr
, collect(type, avg_value) type_map -- Brickhouse collect; creates a map
from (
select hr
, type
, avg( value ) avg_value
from db.table
group by hr, type ) x
group by hr ) y

How to create spark rdd for tree structure

I have a file with multiple types of records. As below
File header
Group header 01
Subgroup 01 s1 s2
Detail record 1 v1,v2,v3,v4
Detail record 2 v1,v2,v3,v4
Detail record 3 v1,v2,v3,v4
Subgroup 02
Detail record 21
Detail record 22
Subgroup 02 end
Group header 01 end
File header end
The file can have multiple groups and records. Each group header also has additional info.
Is there a way to create rdd without preprocessing ?
The objective is to be able to analyse/query data in the file. For eg count of all v1 in group 01

Conversion of 01 to jan , 02 to feb including year in the field

I have a field containing 201402, 201404, here I want to convert 02 to Feb and 04 to April. Is it possible to do that? This field contains entries of all months. Please help.
There is a lot that you can do in terms of datetime format models within Oracle. A simple example below (replace the string literal within the TO_DATE(...) with your field if it is a string or replace the entire TO_DATE with your field if it is already of data type DATE):
SELECT TO_CHAR(TO_DATE('201402','YYYYMM'),'YYYY-MONTH') FROM DUAL;
SELECT TO_CHAR(TO_DATE('201404','YYYYMM'),'YYYY-MONTH') FROM DUAL;

Event Study (Extracting Dates in SAS)

I need to analyse abnormal returns for an event study on mergers and acquisitions.
** I would like to analyse abnormal returns to acquirers by using event windows. Basically I would like to extract the prices for the acquirers using -1 (the day before the announcement date), announcement date, and +1 (the day after the announcement date).**
I have two different datasets to extract information from.
The first is a dataset with all the merger and acquisition information that has the information in the following format:
DealNO AcquirerNO TargetNO AnnouncementDate
123 abcd Cfgg 22/12/2010
222 qwert cddfgf 26/12/1998
In addition, I have a 2nd dataset which has all the prices.
ISINnumber Date Price
abcd 21/12/2010 10
abcd 22/12/2010 11
abcd 23/12/2010 11
abcd 24/12/2010 12
qwert 20/12/1998 20
qwert 21/12/1998 20
qwert 22/12/1998 21
qwert 23/12/1998 21
qwert 24/12/1998 21
qwert 25/12/1998 22
qwert 26/12/1998 21
qwert 27/12/1998 23
ISIN number is the same as acquirer no, and that is the matching code.
In the end I would like to have a database something like this:
DealNO AcquirerNO TargetNO AnnouncementDate Acquirerprice(-1day) Acquireeprice(0day) Acquirerprice(+1day)
123 abcd Cfgg 22/12/2010 10 11 12
222 qwert cddfgf 26/12/1998 22 21 23
Do you know how I can get this?
I'd prefer to use sas to run the code, but if you are familiar with any other programs that can get the data like this, please let me know.
Thank you in advance ^_^.
This can be done quite easily with PROC SQL and joining the PRICE dataset three times. Try this (assuming data set names of ANNOUCE and PRICE):
Warning: untested code
%let day='21DEC2010'd;
proc sql;
create table RESULT as
select a.dealno,
a.acquirerno,
a.targetno,
a.annoucementdate,
p.price as acquirerprice_prev,
c.price as acquirerprice_cur,
n.price as acquirerprice_next
from ANNOUCE a
left join (select * from PRICE where date = &day-1) p on a.acquirerno = p.isinumber
left join (select * from PRICE where date = &day) c on a.acquirerno = c.isinumber
left join (select * from PRICE where date = &day+1) n on a.acquirerno = n.isinumber
;
quit;

How to format a table made by dbms_output.put_line PL/SQL?

I have a procedure that produces a table in the spool:
create procedure.....
......
loop
...
dbms_output.put_line(p_taskno||' '||p_descrip||' '||p_hrs||' '||p_start_date);
.........
The output is correct, however not well formatted:
***************************************
ABC Company Projects:
Project: 5555
TaskNo Description Hours StartDate
_____________________________________________
11 Prototype New Screens 30 23-AUG-06
12 Convert Data Files 10.5 15-SEP-06
13 Create Test Plan 15 14-AUG-06
62 Develop Enterprise Model 280 26-OCT-06
_____________________________________________
Number of Tasks: 4
Total Project Hours: 335.5
I cannot use column description format a20 word_wrapped because the table is the result of the dbms_output.put_line. How can I format it?
You need to work out the maximum size of the column and then pad the output with spaces.
So you want taskno to align with its header, that's six characters. Because it's a numeric you'll want it to align on the right:
lpad(to_char(taskno), 6)
Whereas Description is a string, so you'll want to align it on the left
rpad(p_description, 30)
Use these functions on the elements of the header too, to get the neatest output.

Resources