Skip to content

Instantly share code, notes, and snippets.

@shivallan
shivallan / ren_test_task.sas
Created October 26, 2020 18:39
REN TEST TASK
data test1;
a=1; output;
a=2; output;
a=3; output;
a=4; output;
a=11; output;
a=21; output;
a=31; output;
a=41; output;
a=1; output;
@shivallan
shivallan / CTAS_partition
Created August 24, 2015 14:53
Создание таблицы через select + партиции по дате
create table TEST_PARTITION
partition by range (CREATE_DTTM) (
partition part_Aug2015 values less than (to_date('01-SEP-2015', 'DD-MON-YYYY')),
partition part_Sep2015 values less than (to_date('01-OCT-2015', 'DD-MON-YYYY')),
partition part_Oct2015 values less than (to_date('01-NOV-2015', 'DD-MON-YYYY')),
partition part_Nov2015 values less than (to_date('01-DEC-2015', 'DD-MON-YYYY'))
) as
(
select *
from INT_OFFER.INT_CMFRONT_CHANNEL_PARAMS@OFFERDB_LINK_WRITER where 1=0
create or replace procedure CAMPAIGN_archivator
as
begin
/*CONTACTHISTORY*/
/*Copy old data from original table*/
insert into CAMPAIGN.UA_CONTACTHISTORY_PERSON_HIST
select db.*
from CAMPAIGN.UA_CONTACTHISTORY_PERSON db
where (extract (day from (current_timestamp - db.UPDATEDATETIME))) >= 183;
#include <vector>
#include <algorithm>
#include <iterator>
#include <iostream>
#include <sys/time.h>
void event(std::vector<char> &v, std::vector<unsigned long long> &sp, std::vector<unsigned long long> &ep)
{
char pre_val(0), cur_val(0);
unsigned long long pos(0);
#include <vector>
#include <algorithm>
#include <iterator>
#include <iostream>
#include <sys/time.h>
void event(std::vector<char> &v, std::vector<unsigned long long> &sp, std::vector<unsigned long long> &ep)
{
char pre_val(0), cur_val(0);
unsigned long long pos(0);
* Setting options for macro;
options MCOMPILENOTE = ALL MLOGIC MPRINT MPRINTNEST MLOGICNEST;
* Code for Output CLS;
ods html close; /* close previous */
ods html; /* open new */
%macro mCreateData (mvTable, mvFile);
%put &mvFile;
%local mvOpen;
* Creating of input tables;
filename table_1 'C:\Users\Andrey.Belov\Documents\My SAS Files\My_tasks\1\1_table_1.txt';
filename table_2 'C:\Users\Andrey.Belov\Documents\My SAS Files\My_tasks\1\1_table_2.txt';
filename table_3 'C:\Users\Andrey.Belov\Documents\My SAS Files\My_tasks\1\1_table_3.txt';
libname tasks 'C:\Users\Andrey.Belov\Documents\My SAS Files\My_tasks\1';
data tasks.table_1;
infile table_1;
input ID $ 1-10 Name $ 12-22 Address $ 24-33;
run;
data tasks.table_2;
* Setting options for macro;
options MCOMPILENOTE = ALL MLOGIC MPRINT MPRINTNEST MLOGICNEST;
* Code for Output CLS;
ods html close; /* close previous */
ods html; /* open new */
* My macro for Task #4;
%macro mLookup(mvValue, mvTable, mvLookUpColumn, mvTargetColumn);
%local mvOpen;
#include <vector>
#include <algorithm>
#include <iostream>
#include <sys/time.h>
#include <cstdlib>
using namespace std;
int main()
{
@shivallan
shivallan / MinMax
Last active August 29, 2015 14:19
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <sys/time.h>
using namespace std;
std::pair<int, int> minimax (std::vector<long long> &v)
{